-
Notifications
You must be signed in to change notification settings - Fork 6
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
Pass in a buffer rather than a file path #3
Comments
Sure, we could add that option. I'll accept the pull request if you do one! |
@gignupg seems like its a year old request, are you planning to support buffer/steam in the future? i tested ur work and i would say its more accurate than I'll try to create a PR myself if i find some time |
@gfreecs0510 That's a huge compliment, thanks a lot! |
You can create a blob object from the buffer and pass it as argument to the API, something like: const file= new Blob([buffer]);
languageEncoding(file).then((fileInfo) => console.log(fileInfo)); This should work |
@davuses thx for the code snippet! Would you want to implement it and do a PR? I'm a little bit busy at the moment... |
It's probably not necessary to make changes to the code, like I said above the current API can handle buffer as long as you make a blob object out of it, it's quite simple. So maybe add a snippet demo to show how this could be done in readme file. |
Thx @davuses for clarifying! I added a link to your code snipped in the readme and published a new version to NPM! |
This only works in the browser. I added a PR for support in Node.js: #12. |
Would it be possible to pass in a buffer rather than a file path?
The text was updated successfully, but these errors were encountered: