diff --git a/cli/src/commands/script/script.ts b/cli/src/commands/script/script.ts index 0bca28c294..820bada9b3 100644 --- a/cli/src/commands/script/script.ts +++ b/cli/src/commands/script/script.ts @@ -314,7 +314,8 @@ export async function handleFile( continue; } log.info(`Adding file: ${file.path.substring(1)}`); - const fil = new File([file.contents as BlobPart], file.path.substring(1)); + // .slice() creates new ArrayBuffer, needed for cross-platform compatibility + const fil = new File([file.contents.slice()], file.path.substring(1)); tarball.append(fil); } const endTime = performance.now(); @@ -541,8 +542,8 @@ async function streamToBlob(stream: ReadableStream): Promise { chunks.push(value); } - // Create a Blob from the chunks - const blob = new Blob(chunks as BlobPart[]); + // Create a Blob from the chunks (.map with slice for cross-platform compatibility) + const blob = new Blob(chunks.map(c => c.slice())); return blob; }