web/workers: append type to outputted files

This commit is contained in:
jj 2025-05-04 19:00:56 +00:00
parent f655432376
commit b6a207a9b0
No known key found for this signature in database
3 changed files with 6 additions and 9 deletions

View File

@ -120,12 +120,7 @@ export default class LibAVWrapper {
outputName outputName
]); ]);
const file = new File( const file = Storage.retype(await storage.res(), output.type);
[ await storage.res() ],
outputName,
{ type: output.type }
);
if (file.size === 0) return; if (file.size === 0) return;
return file; return file;

View File

@ -13,3 +13,7 @@ export function init(expectedSize?: number): Promise<AbstractStorage> {
throw "no storage method is available"; throw "no storage method is available";
} }
export function retype(file: File, type: string) {
return new File([ file ], file.name, { type });
}

View File

@ -76,9 +76,7 @@ const fetchFile = async (url: string) => {
return error("tunnel is broken"); return error("tunnel is broken");
} }
const file = new File( const file = Storage.retype(await storage.res(), contentType);
[ await storage.res() ], '', { type: contentType }
);
if (contentLength && Number(contentLength) !== file.size) { if (contentLength && Number(contentLength) !== file.size) {
return error("file was not downloaded fully"); return error("file was not downloaded fully");