Skip to content

Commit

Permalink
Rewrote fileToUint8Array function to be also NodeJS/Deno compatible.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbuella committed Jan 10, 2025
1 parent 4c2964a commit 61393ef
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/php-wasm/universal/src/lib/encode-as-multipart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,5 @@ export async function encodeAsMultipart(
}

function fileToUint8Array(file: File): Promise<Uint8Array> {
return new Promise((resolve) => {
const reader = new FileReader();
reader.onload = () => {
resolve(new Uint8Array(reader.result as ArrayBuffer));
};
reader.readAsArrayBuffer(file);
});
return file.arrayBuffer().then((fileBuffer) => new Uint8Array(fileBuffer));
}

0 comments on commit 61393ef

Please sign in to comment.