Skip to content

Commit

Permalink
Merge pull request #51 from Priestch/master
Browse files Browse the repository at this point in the history
get arrayBuffer directly from response.arrayBuffer()
  • Loading branch information
Paulo Coutinho authored Nov 6, 2021
2 parents f4e6fbb + b0a0dcc commit 540c05f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions extras/wasm/template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,8 @@
resetOnLoad();

let response = await fetch(url);
let data = await response.blob();
let metadata = {
type: 'application/pdf'
};

let file = new File([data], "file.pdf", metadata);

let fileByteArray = await fileToByteArray(file);
let fileBuffer = await response.arrayBuffer();
let fileByteArray = new Uint8Array(fileBuffer);

if (fileByteArray.length <= 0) {
throw { message: "The PDF file is invalid" };
Expand Down

0 comments on commit 540c05f

Please sign in to comment.