From 2eac74cef4aa5a987fb16110388f99e912951db8 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 17 Jan 2026 21:18:51 +0000 Subject: [PATCH] fix: resolve BlobPart type incompatibility between Deno and Node.js Use .slice() on Uint8Array values before passing to File/Blob constructors to create fresh ArrayBuffer-backed arrays, avoiding type errors from ArrayBufferLike vs ArrayBuffer differences in TypeScript definitions. Co-Authored-By: Claude Opus 4.5 --- cli/src/commands/script/script.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; }