stream-to-pull-stream
Advanced tools
Comparing version 1.6.1 to 1.6.2
27
index.js
@@ -19,5 +19,7 @@ var pull = require('pull-core') | ||
function write(read, stream, cb) { | ||
var ended, closed = false | ||
function done (end) { | ||
cb && cb(end === true ? null : end) | ||
var ended, closed = false, did | ||
function done () { | ||
if(did) return | ||
did = true | ||
cb && cb(ended === true ? null : ended) | ||
} | ||
@@ -46,2 +48,3 @@ function onClose () { | ||
ended = ended || end | ||
end && console.log('end', end) | ||
if(end === true) | ||
@@ -68,3 +71,3 @@ return stream._isStdio ? done() : stream.end() | ||
handler(val) | ||
} | ||
} | ||
events.forEach(function (e) { | ||
@@ -152,7 +155,3 @@ emitter.on(e, listener) | ||
function read (stream) { | ||
if('function' === typeof stream.read) | ||
return read2(stream) | ||
return read1(stream) | ||
} | ||
var read = read1 | ||
@@ -166,3 +165,3 @@ var sink = function (stream, cb) { | ||
var source = function (stream) { | ||
return pull.Source(function () { return read(stream) })() | ||
return pull.Source(function () { return read1(stream) })() | ||
} | ||
@@ -172,8 +171,8 @@ | ||
return ( | ||
stream.writable | ||
(stream.writable && stream.write) | ||
? stream.readable | ||
? pull.Through(function(_read) { | ||
write(_read, stream, cb); | ||
return read(stream) | ||
})() | ||
write(_read, stream, cb); | ||
return read1(stream) | ||
})() | ||
: sink(stream, cb) | ||
@@ -180,0 +179,0 @@ : source(stream) |
{ | ||
"name": "stream-to-pull-stream", | ||
"description": "convert a stream1 or streams2 stream into a pull-stream", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"homepage": "https://github.com/dominictarr/stream-to-pull-stream", | ||
@@ -11,3 +11,4 @@ "repository": { | ||
"dependencies": { | ||
"pull-core": "~1.0.0" | ||
"pull-core": "~1.0.0", | ||
"pull-stream": "^2.27.0" | ||
}, | ||
@@ -14,0 +15,0 @@ "devDependencies": { |
@@ -16,4 +16,6 @@ var pull = require('pull-stream') | ||
}) | ||
pull.infinite() | ||
.pipe(function (read) { | ||
pull( | ||
pull.infinite(), | ||
function (read) { | ||
return function (abort, cb) { | ||
@@ -23,6 +25,7 @@ if(abort) return t.ok(true), t.end() | ||
} | ||
}) | ||
.pipe(toPull(ts)) | ||
.pipe(pull.drain()) | ||
}, | ||
toPull(ts), | ||
pull.drain() | ||
) | ||
}) |
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
11044
358
2
+ Addedpull-stream@^2.27.0
+ Addedpull-core@1.1.0(transitive)
+ Addedpull-stream@2.28.4(transitive)