Comparing version 0.1.0 to 0.1.1
@@ -5,2 +5,5 @@ const DuplexStream = require('readable-stream/duplex') | ||
function BufferList (callback) { | ||
if (!(this instanceof BufferList)) | ||
return new BufferList(callback) | ||
if (typeof callback == 'function') | ||
@@ -7,0 +10,0 @@ this._callback = callback |
{ | ||
"name" : "bl" | ||
, "version" : "0.1.0" | ||
, "version" : "0.1.1" | ||
, "description" : "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!" | ||
@@ -5,0 +5,0 @@ , "main" : "bl.js" |
@@ -41,7 +41,7 @@ # bl *(BufferList)* | ||
```js | ||
const BufferList = require('bl') | ||
, fs = require('fs') | ||
const bl = require('bl') | ||
, fs = require('fs') | ||
fs.createReadStream('README.md') | ||
.pipe(new BufferList(function (err, data) { | ||
.pipe(bl(function (err, data) { // note 'new' isn't strictly required | ||
// `data` is just a reference to the BufferList | ||
@@ -52,4 +52,15 @@ console.log(data.toString()) | ||
Or, use it as a readable stream: | ||
Or to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) too): | ||
```js | ||
const hyperquest = require('hyperquest') | ||
, bl = require('./') | ||
, url = 'https://raw.github.com/rvagg/bl/master/README.md' | ||
hyperquest(url).pipe(bl(function (err, data) { | ||
console.log(data.toString()) | ||
})) | ||
``` | ||
Or, use it as a readable stream to recompose a list of Buffers to an output source: | ||
```js | ||
@@ -87,2 +98,14 @@ const BufferList = require('bl') | ||
`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with: | ||
```js | ||
var bl = require('bl') | ||
var myinstance = bl() | ||
// equivilant to: | ||
var BufferList = require('bl') | ||
var myinstance = new BufferList() | ||
``` | ||
-------------------------------------------------------- | ||
@@ -89,0 +112,0 @@ <a name="length"></a> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22182
353
155