Skip to content

Add Buffer creation convenience #70

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Cyrildavids
Copy link

@Cyrildavids Cyrildavids commented Aug 6, 2017

For some reason when i try to use this in an Angular Application it complains about fs.readFile not existing. So i resorted to using the base64 version of the image binary. I had to modify the library to accept base64 string without interfering with any of the processes that are already exists except converting base64 string to an array buffer and then on to a Buffer ready for processing.
An example usage will be
new EXIFImage({ image: this.base64Image, imageDataType: 'base64' }, function (error, exifData) { if (error) console.log('Error: ' + error.message); else { console.log(exifData); // Do something with your data! } });
or
new EXIFImage({ image: this.arrayBuffer, imageDataType: 'ArrayBuffer' }, function (error, exifData) { if (error) console.log('Error: ' + error.message); else { console.log(exifData); // Do something with your data! } });

@oeuillot
Copy link
Collaborator

oeuillot commented Aug 7, 2017

Hello,
Why dont you use UInt8Array.from(source) ?

https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/TypedArray/from

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

Successfully merging this pull request may close these issues.

3 participants