Skip to content

Commit

Permalink
Get rid of loadBinaryFile error bug. Fix #1675
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasrw committed Apr 28, 2023
1 parent 5f7debd commit 2008540
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/15utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ var loadBinaryFile = (utils.loadBinaryFile = function (
var data = e.target.result;
success(data);
};
reader.onerror = error();
reader.onerror = error;
reader.readAsArrayBuffer(files[0]);
} else if (path instanceof Blob) {
success(path);
Expand Down
2 changes: 1 addition & 1 deletion test/test238.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"100": 100}]
[{"100":100}]

3 comments on commit 2008540

@jimmywarting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know, you could just use files[0].arrayBuffer().then(success, error) instead of using the hole FileReader...

@mathiasrw
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I like it. Happy to include it in the next PR that comes along.

How do we get the name with this method?

@jimmywarting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the filereader have nothing to do with getting the file name.
you can get the filename from using files[0]. name

Please sign in to comment.