web: use AbstractStorage everywhere

This commit is contained in:
jj 2025-04-30 18:01:02 +00:00
parent ce4ded64a2
commit 95ab81eb10
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,4 @@
import { OPFSStorage } from "$lib/storage/opfs";
import * as Storage from "$lib/storage";
import LibAV, { type LibAV as LibAVInstance } from "@imput/libav.js-remux-cli";
import EncodeLibAV from "@imput/libav.js-encode-cli";
@ -95,7 +95,8 @@ export default class LibAVWrapper {
await libav.mkwriterdev(outputName);
await libav.mkwriterdev('progress.txt');
const storage = await OPFSStorage.init();
const totalInputSize = files.reduce((a, b) => a + b.file.size, 0);
const storage = await Storage.init(totalInputSize);
libav.onwrite = async (name, pos, data) => {
if (name === 'progress.txt') {

View File

@ -1,4 +1,4 @@
import { OPFSStorage } from "$lib/storage/opfs";
import * as Storage from "$lib/storage";
let attempts = 0;
@ -37,7 +37,7 @@ const fetchFile = async (url: string) => {
const contentLength = response.headers.get('Content-Length');
const estimatedLength = response.headers.get('Estimated-Content-Length');
let totalBytes = null;
let totalBytes;
if (contentLength) {
totalBytes = +contentLength;
@ -47,7 +47,7 @@ const fetchFile = async (url: string) => {
const reader = response.body?.getReader();
const storage = await OPFSStorage.init();
const storage = await Storage.init(totalBytes);
if (!reader) {
return error("no reader");