Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for TypedArrays #27

Open
patrickroberts opened this issue Jun 30, 2017 · 7 comments
Open

Add support for TypedArrays #27

patrickroberts opened this issue Jun 30, 2017 · 7 comments

Comments

@patrickroberts
Copy link

Given the reduced memory consumption of using TypedArrays instead of UTF-16 encoded JavaScript strings, I can see this being a huge benefit for piexifjs.

Would you consider a pull-request that implemented support for this, and if so, how would you want to add it to your API? Would each of the existing functions just check the type of the input and act accordingly, or would you want separate functions for dealing with TypedArrays instead of strings?

@hMatoba
Copy link
Owner

hMatoba commented Jul 3, 2017

Thanks for suggestion.

If latest stable browsers and nodejs support for TypedArrays, I decide to support for TypedArrays. When I started this library, browsers didn't support for it.

I think that this library should choose "just check the type of the input and act accordingly".

@patrickroberts
Copy link
Author

According to this chart, all modern browsers (not just major) fully support TypedArray. Even IE >=10 supports everything except Uint8ClampedArray, but I can just use Uint8Array to include IE 10 support.

And according to this other chart, Node.js has fully supported TypedArray since 0.12, which is very old. The only features unsupported were the ones pertaining to TypedArray and ES6 syntax, which obviously didn't gain support until around 4.0, but that can easily be avoided in an implementation.

@hMatoba
Copy link
Owner

hMatoba commented Jul 3, 2017

Yeah! Thank you!
We need only Uint8Array. I think so, too.
This library should be implemented.

@micahjon
Copy link

Glad this is on your radar. We've found at BeFunky that FileReader.readAsBinaryString can be unreliable (it's deprecated in favor of FileReader.readAsArrayBufferand sometimes fails in Chrome on Mac), and FileReader.readAsDataURL (base64) is slow.

Supporting Uint8Array would allow us to use FileReader.readAsArrayBuffer which is both fast and reliable in all browsers.

@fatso83
Copy link

fatso83 commented May 31, 2019

This would potentially also opening up for minimal reading: only reading file data incrementally up until the exif data ends. Currently one has to make an educated guess at a decent max size to stop reading, like mentioned here.

@mheskol
Copy link

mheskol commented Sep 28, 2021

I second this suggestion and say that TypedArrays became widely used facility to handle byte data. The support for it is almost universal nowadays.
Any plans to adding support for it?

@fatso83
Copy link

fatso83 commented Oct 5, 2021

@mheskol This library is dead, ref #78. If you need the functionality, start a fork, implement and publish it to NPM to to share it with the world 🚀 If you do not need write-support, ExifReader is in active development and is maintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants