stream-to-pull-stream
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -44,6 +44,7 @@ var pull = require('pull-core') | ||
if(end === true) | ||
return stream._isStdio || stream.end() | ||
return stream._isStdio ? done() : stream.end() | ||
if(ended = ended || end) { | ||
if(stream.destroy) stream.destroy() | ||
else return cb(ended) | ||
stream.destroy && stream.destroy() | ||
return done(ended) | ||
} | ||
@@ -50,0 +51,0 @@ var pause = stream.write(data) |
{ | ||
"name": "stream-to-pull-stream", | ||
"description": "convert a stream1 or streams2 stream into a pull-stream", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"homepage": "https://github.com/dominictarr/stream-to-pull-stream", | ||
@@ -6,0 +6,0 @@ "repository": { |
var pull = require('pull-stream') | ||
var fs = require('fs') | ||
var tape = require('tape') | ||
var toPullStream = require('../') | ||
pull.values([ | ||
'hello\n', | ||
' there\n' | ||
]) | ||
.pipe(toPullStream(process.stdout)) | ||
pull( | ||
pull.values([ | ||
'hello\n', | ||
' there\n' | ||
]), | ||
toPullStream(process.stdout) | ||
) | ||
toPullStream(fs.createReadStream(__filename)) | ||
.pipe(pull.map(function (e) { return e.toString().toUpperCase() })) | ||
.pipe(toPullStream(process.stdout)) | ||
tape('get end callback even with stdout', function (t) { | ||
pull( | ||
toPullStream(fs.createReadStream(__filename)), | ||
pull.map(function (e) { return e.toString().toUpperCase() }), | ||
toPullStream.sink(process.stdout, function (err) { | ||
console.log('----END!') | ||
t.end() | ||
}) | ||
) | ||
}) |
@@ -5,4 +5,6 @@ var pull = require('pull-stream') | ||
require('tape')('propagate close back to source', function (t) { | ||
var tape = require('tape') | ||
tape('propagate close back to source', function (t) { | ||
// t.plan(4) | ||
@@ -18,2 +20,3 @@ | ||
}) | ||
pull( | ||
@@ -25,4 +28,28 @@ pull.values([1,2,3]), | ||
t.end() | ||
})) | ||
}) | ||
) | ||
}) | ||
tape('error', function (t) { | ||
var ts = through() | ||
var err = new Error('wtf') | ||
pull( | ||
pull.values([1,2,3]), | ||
function (read) { | ||
return function (abort, cb) { | ||
read(abort, function (end, data) { | ||
if(data === 3) cb(err) | ||
else cb(end, data) | ||
}) | ||
} | ||
}, | ||
toPull.sink(ts, function (_err) { | ||
t.equal(_err, err) | ||
t.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
10727
349