Skip to content

Commit

Permalink
*: use blob.arrayBuffer() instead of FileReader
Browse files Browse the repository at this point in the history
  • Loading branch information
montyanderson committed Jan 4, 2025
1 parent 522bea6 commit 51401d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
},
"author": "Monty Anderson <[email protected]>",
"license": "ISC",
"engines": {
"node": ">=18.0.0"
},
"devDependencies": {
"prettier": "^3.0.0",
"typescript": "^5.1.6"
Expand Down
8 changes: 1 addition & 7 deletions v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,7 @@ export const createProdia = ({
);
}

const buffer = await new Promise<ArrayBuffer>((resolve, reject) => {
const output = body.get("output") as File;
const reader = new FileReader();
reader.readAsArrayBuffer(output);
reader.onload = () => resolve(reader.result as ArrayBuffer);
reader.onerror = () => reject(new Error("Failed to read output"));
});
const buffer = await (body.get("output") as Blob).arrayBuffer();

return {
job: job,
Expand Down

0 comments on commit 51401d3

Please sign in to comment.