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

Allow any array-like object as buffer - no string checks #9

Open
coolaj86 opened this issue Nov 17, 2015 · 2 comments
Open

Allow any array-like object as buffer - no string checks #9

coolaj86 opened this issue Nov 17, 2015 · 2 comments

Comments

@coolaj86
Copy link
Collaborator

This could work equally well in the browser and node if a v2.0.0 were released that simply expected an Array-like object as input (Buffer, TypedArray, Array) without any detection or formatting being done by the library itself.

I'd be happy to PR such a version.

@chrisumbel
Copy link
Owner

i like it

@jimmywarting
Copy link

jimmywarting commented Nov 26, 2018

Me too
Beside, the constructor is deprecated since a long time ago.

if(!Buffer.isBuffer(encoded)){
encoded = new Buffer(encoded);
}
var decoded = new Buffer(Math.ceil(encoded.length * 5 / 8));

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

3 participants