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

Buffer.isBuffer returns false for Buffers #31

Open
thlorenz opened this issue Sep 27, 2013 · 3 comments
Open

Buffer.isBuffer returns false for Buffers #31

thlorenz opened this issue Sep 27, 2013 · 3 comments

Comments

@thlorenz
Copy link

I ran into this while writing a browser side Writable Stream.
The problem is basically that Buffer.isBuffer(buf) returns false although it is one. This is due to buf instanceof Buffer returning false -- I tried this in the browser console as well.

I commented on my workaround here.

You could use this project as a test bed, i.e.:

npm install d3-gauge-writable
npm explore d3-gauge-writable
npm start

You should then be able to debug into d3-gauge-writable assuming you enabled source maps on your browser.

@mscdex
Copy link
Contributor

mscdex commented Nov 2, 2013

@toots Any chance of getting this fixed? I'm currently having to manually change Buffer.isBuffer() to use util.isBuffer()'s logic (similar to @thlorenz's workaround) because require('stream').Readable uses Buffer.isBuffer() in chunkInvalid() and that always fails with the current Buffer.isBuffer() implementation.

@toots
Copy link
Owner

toots commented Nov 2, 2013

Hi guys. Unfortunately, I don't have a lot of time to investigate this at the moment. I'd be happy to consider a PR, although I am concerned as to why buf instanceof Buffer isn't returning the expected value. Maybe there's something more important going on here..

@mscdex
Copy link
Contributor

mscdex commented Nov 13, 2013

I think this may be related to browserify/browserify#513 in which two copies of Buffer are injected into bundles.

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