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

BufferList object check method #48

Closed
abdulhannanali opened this issue Nov 20, 2017 · 1 comment
Closed

BufferList object check method #48

abdulhannanali opened this issue Nov 20, 2017 · 1 comment

Comments

@abdulhannanali
Copy link

Exposing a static method called isBufferList to check whether the list can be helpful since Buffer also has isBuffer. Do you think it would be helpful?

@rvagg
Copy link
Owner

rvagg commented Nov 21, 2017

Yeah, that's not a terrible idea, although instanceof should work just fine. If you submit a PR with that then I think we'd ship it.

rvagg pushed a commit that referenced this issue Sep 17, 2019
Now you can get a `BufferList` without the `readable-stream` bits for a smaller browser bundle.

`bl` now exports 2 classes:

1. `BufferList`
2. `BufferListStream`

`BufferListStream` **is the default export** (and so is backwards compatible). i.e.

```js
const { BufferListStream } = require('bl')
// equivalent to:
const BufferListStream = require('bl')
```

I've updated the README to recommend typical use like:

```js
const { BufferList } = require('bl')
// or
const { BufferListStream } = require('bl')
```

Simply `require('bl/BufferList')` in the browser to get **JUST** the `BufferList` class that does not inherit from `Duplex`.

Added static function `BufferList.isBufferList(obj)` which checks if the passed object has a `_isBufferList` property (similar to how `Buffer.isBuffer(obj)` works).

resolves #48
resolves #70
resolves #71
@rvagg rvagg closed this as completed in bb0e3bd Sep 19, 2019
rvagg pushed a commit that referenced this issue Sep 19, 2019
Now you can get a `BufferList` without the `readable-stream` bits for a smaller browser bundle.

`bl` now exports 2 classes:

1. `BufferList`
2. `BufferListStream`

`BufferListStream` **is the default export** (and so is backwards compatible). i.e.

```js
const { BufferListStream } = require('bl')
// equivalent to:
const BufferListStream = require('bl')
```

I've updated the README to recommend typical use like:

```js
const { BufferList } = require('bl')
// or
const { BufferListStream } = require('bl')
```

Simply `require('bl/BufferList')` in the browser to get **JUST** the `BufferList` class that does not inherit from `Duplex`.

Added static function `BufferList.isBufferList(obj)` which checks if the passed object has a `_isBufferList` property (similar to how `Buffer.isBuffer(obj)` works).

resolves #48
resolves #70
resolves #71
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 a pull request may close this issue.

3 participants
@rvagg @abdulhannanali and others