best way to save what you love
Svelte collaborationdownloaderinstagramjavascriptmusicredditsocial-mediasoundcloudsveltetiktoktwittertypescriptvideovimeovkwebappyoutubeyoutube-downloader
web: use AbstractStorage everywhere
jj95ab81eb10ee
diff --git a/web/src/lib/libav.ts b/web/src/lib/libav.tsindex 05ffe707..111e1e0b 100644--- a/web/src/lib/libav.ts+++ b/web/src/lib/libav.ts@@ -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') {diff --git a/web/src/lib/task-manager/workers/fetch.ts b/web/src/lib/task-manager/workers/fetch.tsindex 85f2d60e..253286c8 100644--- a/web/src/lib/task-manager/workers/fetch.ts+++ b/web/src/lib/task-manager/workers/fetch.ts@@ -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");