stream-read
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -43,2 +43,3 @@ var dz = require('dezalgo'); | ||
if (!stream.readable) return cb(); | ||
var ended = false; | ||
@@ -52,3 +53,6 @@ function onreadable() { | ||
cleanup(); | ||
cb(null, null); | ||
if (!ended) { | ||
ended = true; | ||
cb(null, null); | ||
} | ||
} | ||
@@ -83,2 +87,3 @@ | ||
var buf = stream.read(); | ||
stream.removeListener('error', _onerror); | ||
if (errored) return; | ||
@@ -85,0 +90,0 @@ if (buf) cb(null, buf); |
{ | ||
"name": "stream-read", | ||
"description": "Read from a stream, callback style", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"repository": "micnews/stream-read", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -6,2 +6,4 @@ | ||
[![build status](https://secure.travis-ci.org/micnews/stream-read.svg)](http://travis-ci.org/micnews/stream-read) | ||
## Example | ||
@@ -8,0 +10,0 @@ |
10
test.js
@@ -162,1 +162,11 @@ var Readable = require('stream').Readable; | ||
test('pull double end', function(t){ | ||
t.plan(1); | ||
var stream = Readable(); | ||
stream._read = function(){ this.push(null) }; | ||
read(stream, function(err, val){ | ||
t.equal(val, null); | ||
}); | ||
stream.emit('end'); | ||
}); | ||
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
6120
7
226
32