stream-collect
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -24,3 +24,3 @@ /* jshint node: true */ | ||
debug( 'adding collect method' ); | ||
debug( 'adding collect method', this._readableState.objectMode, this._readableState.encoding ); | ||
@@ -89,3 +89,6 @@ var collected; | ||
stream | ||
.pipe( new PassThrough( { encoding: encoding } ) ) | ||
.pipe( new PassThrough( { | ||
encoding: encoding, | ||
objectMode: stream._readableState.objectMode | ||
} ) ) | ||
.on( 'collect', function(data) { | ||
@@ -92,0 +95,0 @@ defer.resolve(data); |
{ | ||
"name": "stream-collect", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Collects the output of a stream", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# Stream collect | ||
[![npm version](https://badge.fury.io/js/stream-collect.svg)](http://badge.fury.io/js/stream-collect) | ||
Collects a readable streams data as a string buffer or, for object streams, an array. | ||
@@ -4,0 +6,0 @@ |
@@ -167,2 +167,20 @@ /* jshint node: true, mocha: true */ | ||
it( 'collects object data', function() { | ||
var stream = new PassThrough( {objectMode: true}); | ||
var ret = collect(stream); | ||
stream.write(1); | ||
stream.write(2); | ||
stream.end(3); | ||
return ret | ||
.then( function(data) { | ||
expect( Array.isArray(data) ).toBe(true); | ||
expect( data ).toEqual( [1,2,3] ); | ||
} ); | ||
} ); | ||
} ); |
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
3300856
221
63