fix: blob 2GB limit
This commit is contained in:
parent
81c9cc1b8a
commit
8250b42714
1 changed files with 1 additions and 8 deletions
|
|
@ -54,20 +54,13 @@ export async function mergeAndDownload(
|
|||
}
|
||||
|
||||
const totalLength = chunks.reduce((sum, c) => sum + c.length, 0);
|
||||
const merged = new Uint8Array(totalLength);
|
||||
let offset = 0;
|
||||
for (const chunk of chunks) {
|
||||
merged.set(chunk, offset);
|
||||
offset += chunk.length;
|
||||
}
|
||||
|
||||
log.info(`mergeAndDownload: merged ${chunks.length} chunks, total=${totalLength} bytes`);
|
||||
|
||||
const ext = segments.length > 0 && segments[0].uri.toLowerCase().includes('.m4s') ? '.mp4' : '.ts';
|
||||
const filename = guessFilename(m3u8Url) + (guessFilename(m3u8Url).includes('.') ? '' : ext);
|
||||
|
||||
const mimeType = ext === '.mp4' ? 'video/mp4' : 'video/mp2t';
|
||||
const blob = new Blob([merged], { type: mimeType });
|
||||
const blob = new Blob(chunks, { type: mimeType });
|
||||
downloadBlob(blob, filename);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue