mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 09:28:29 +00:00
web: use AbstractStorage everywhere
This commit is contained in:
parent
ce4ded64a2
commit
95ab81eb10
@ -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 LibAV, { type LibAV as LibAVInstance } from "@imput/libav.js-remux-cli";
|
||||||
import EncodeLibAV from "@imput/libav.js-encode-cli";
|
import EncodeLibAV from "@imput/libav.js-encode-cli";
|
||||||
|
|
||||||
@ -95,7 +95,8 @@ export default class LibAVWrapper {
|
|||||||
await libav.mkwriterdev(outputName);
|
await libav.mkwriterdev(outputName);
|
||||||
await libav.mkwriterdev('progress.txt');
|
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) => {
|
libav.onwrite = async (name, pos, data) => {
|
||||||
if (name === 'progress.txt') {
|
if (name === 'progress.txt') {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { OPFSStorage } from "$lib/storage/opfs";
|
import * as Storage from "$lib/storage";
|
||||||
|
|
||||||
let attempts = 0;
|
let attempts = 0;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ const fetchFile = async (url: string) => {
|
|||||||
const contentLength = response.headers.get('Content-Length');
|
const contentLength = response.headers.get('Content-Length');
|
||||||
const estimatedLength = response.headers.get('Estimated-Content-Length');
|
const estimatedLength = response.headers.get('Estimated-Content-Length');
|
||||||
|
|
||||||
let totalBytes = null;
|
let totalBytes;
|
||||||
|
|
||||||
if (contentLength) {
|
if (contentLength) {
|
||||||
totalBytes = +contentLength;
|
totalBytes = +contentLength;
|
||||||
@ -47,7 +47,7 @@ const fetchFile = async (url: string) => {
|
|||||||
|
|
||||||
const reader = response.body?.getReader();
|
const reader = response.body?.getReader();
|
||||||
|
|
||||||
const storage = await OPFSStorage.init();
|
const storage = await Storage.init(totalBytes);
|
||||||
|
|
||||||
if (!reader) {
|
if (!reader) {
|
||||||
return error("no reader");
|
return error("no reader");
|
||||||
|
Loading…
Reference in New Issue
Block a user