Giter Site home page Giter Site logo

Comments (16)

feross avatar feross commented on July 25, 2024

@phated Is this is a node.js or browserify SlowBuffer? If node.js, what version are you using?

Can you share sample code where you expect this package to return true?

from is-buffer.

feross avatar feross commented on July 25, 2024

I can't reproduce. In node v4 and browserify, this works as expected:

var isBuffer = require('is-buffer')
isBuffer(new require('buffer').SlowBuffer(1000)) // true

from is-buffer.

feross avatar feross commented on July 25, 2024

@phated Ping.

from is-buffer.

phated avatar phated commented on July 25, 2024

Sorry for the delay. I just tried your example in node 0.10 and it fails.

from is-buffer.

phated avatar phated commented on July 25, 2024

Looks like it is working in >=0.12 (which is weird, because our vinyl-fs tests were failing on that version too).

from is-buffer.

feross avatar feross commented on July 25, 2024

Ah, this is because SlowBuffer is a different class in node 0.10 and there's no SlowBuffer.isBuffer method.

from is-buffer.

feross avatar feross commented on July 25, 2024

Have you considered just dropping node 0.10 support? It's going to be completely unsupported (even no security updates) in October 2016.

from is-buffer.

phated avatar phated commented on July 25, 2024

Nope. It is still maintained, has tons of users and I personally see it as the most stable version of node (still).

from is-buffer.

phated avatar phated commented on July 25, 2024

If you don't plan to support it, can you mark the package with engines so devs will be warned when attempting to use it? I shipped a broken version of vinyl-fs due to this problem.

from is-buffer.

phated avatar phated commented on July 25, 2024

Another note: Buffer.isBuffer() in node 0.10 correctly identifies the SlowBuffer, which is what I switched to.

from is-buffer.

feross avatar feross commented on July 25, 2024

If you're in node, you can of course use Buffer.isBuffer(). The primary purpose of this package is to avoid including the whole Buffer package in your browser javascript bundle if you just need to check if something is a buffer because normally it will be included if you do Buffer.isBuffer().

Is vinyl-fs supposed to work with browserify?

from is-buffer.

phated avatar phated commented on July 25, 2024

@feross yeah, in 2.0 removed the watch method so there were no native modules and we recently received an issue related to someone browserifying the package.

from is-buffer.

feross avatar feross commented on July 25, 2024

If you're not carefully curating your node package dependencies to ensure that no one is calling require('buffer') or using the Buffer global, then the whole buffer package will end up in the browser bundle anyway, so I'd just continue using Buffer.isBuffer().

Thanks for opening the issue and sorry for breaking your package.

from is-buffer.

feross avatar feross commented on July 25, 2024

For example, one of your dependencies uses buffer here.

from is-buffer.

phated avatar phated commented on July 25, 2024

Thanks. I really hope you update the package.json to note the engine dependency. You don't have to use engineStrict but the warning would be really helpful.

from is-buffer.

feross avatar feross commented on July 25, 2024

Sure thing.

from is-buffer.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.