From 34129e7503fca1fa1af45eddc31f31a2116ba06f Mon Sep 17 00:00:00 2001 From: "Marlon B. Buella" Date: Fri, 10 Jan 2025 02:02:05 +0000 Subject: [PATCH] Added comment to explain the usage of more supported arrayBuffer() method instead of FileReader. --- packages/php-wasm/universal/src/lib/encode-as-multipart.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/php-wasm/universal/src/lib/encode-as-multipart.ts b/packages/php-wasm/universal/src/lib/encode-as-multipart.ts index 4fa4c6a6fa..f4fb294e18 100644 --- a/packages/php-wasm/universal/src/lib/encode-as-multipart.ts +++ b/packages/php-wasm/universal/src/lib/encode-as-multipart.ts @@ -47,5 +47,9 @@ export async function encodeAsMultipart( } function fileToUint8Array(file: File): Promise { + /** + * @mbuella: Use File.arrayBuffer() to get a Uint8Array from a file, avoiding FileReader + * which is browser-specific. This method is supported in major browsers and NodeJS/Deno runtimes. + */ return file.arrayBuffer().then((fileBuffer) => new Uint8Array(fileBuffer)); }