stream-to-pull-stream
Advanced tools
+10
-6
@@ -1,2 +0,2 @@ | ||
| var pull = require('pull-core') | ||
| var pull = require('pull-stream/pull') | ||
@@ -166,9 +166,9 @@ function destroy(stream, cb) { | ||
| var sink = function (stream, cb) { | ||
| return pull.Sink(function (read) { | ||
| return function (read) { | ||
| return write(read, stream, cb) | ||
| })() | ||
| } | ||
| } | ||
| var source = function (stream) { | ||
| return pull.Source(function () { return read1(stream) })() | ||
| return read1(stream) | ||
| } | ||
@@ -180,6 +180,6 @@ | ||
| ? stream.readable | ||
| ? pull.Through(function(_read) { | ||
| ? function(_read) { | ||
| write(_read, stream, cb); | ||
| return read1(stream) | ||
| })() | ||
| } | ||
| : sink(stream, cb) | ||
@@ -201,1 +201,5 @@ : source(stream) | ||
| } | ||
+1
-1
| { | ||
| "name": "stream-to-pull-stream", | ||
| "description": "convert a stream1 or streams2 stream into a pull-stream", | ||
| "version": "1.6.6", | ||
| "version": "1.6.7", | ||
| "homepage": "https://github.com/dominictarr/stream-to-pull-stream", | ||
@@ -6,0 +6,0 @@ "repository": { |
+19
-19
@@ -14,22 +14,22 @@ var pull = require('pull-stream') | ||
| }) | ||
| pull.values([.1, .4, .6, 0.7, .94, 0.3]) | ||
| pull( | ||
| pull.values([.1, .4, .6, 0.7, .94, 0.3]), | ||
| // pull.infinite() | ||
| .pipe(toPull(ts)) | ||
| .pipe(function (read) { | ||
| console.log('reader!') | ||
| read(null, function next (end, data) { | ||
| console.log('>>>', end, data) | ||
| if(data > 0.9) { | ||
| console.log('ABORT') | ||
| read(true, function (end) { | ||
| t.ok(true) | ||
| t.end() | ||
| }) | ||
| } else { | ||
| read(null, next) | ||
| } | ||
| }) | ||
| }) | ||
| toPull(ts), | ||
| function (read) { | ||
| console.log('reader!') | ||
| read(null, function next (end, data) { | ||
| console.log('>>>', end, data) | ||
| if(data > 0.9) { | ||
| console.log('ABORT') | ||
| read(true, function (end) { | ||
| t.ok(true) | ||
| t.end() | ||
| }) | ||
| } else { | ||
| read(null, next) | ||
| } | ||
| }) | ||
| } | ||
| ) | ||
| }) |
+8
-7
@@ -9,10 +9,11 @@ var pull = require('pull-stream') | ||
| var values = [.1, .4, .6, 0.7, .94] | ||
| pull( | ||
| pull.values(values), | ||
| toPull(through()), | ||
| pull.collect(function (err, _values) { | ||
| t.deepEqual(_values, values) | ||
| t.end() | ||
| }) | ||
| ) | ||
| pull.values(values) | ||
| .pipe(toPull(through())) | ||
| .pipe(pull.collect(function (err, _values) { | ||
| t.deepEqual(_values, values) | ||
| t.end() | ||
| })) | ||
| }) |
+17
-11
@@ -13,9 +13,12 @@ var http = require('http') | ||
| var server = http.createServer(function (req, res) { | ||
| toPull(req).pipe(pull.reduce(function (b, s) { | ||
| return b + s | ||
| }, '', function (err, body) { | ||
| t.equal(body, thisFile) | ||
| t.notOk(err) | ||
| res.end('done') | ||
| })) | ||
| pull( | ||
| toPull(req), | ||
| pull.reduce(function (b, s) { | ||
| return b + s | ||
| }, '', function (err, body) { | ||
| t.equal(body, thisFile) | ||
| t.notOk(err) | ||
| res.end('done') | ||
| }) | ||
| ) | ||
| }).listen(port, function () { | ||
@@ -30,6 +33,9 @@ | ||
| _res.pipe(pull.collect(function (err, ary) { | ||
| t.equal(ary.map(String).join(''), 'done') | ||
| t.end() | ||
| })) | ||
| pull( | ||
| _res, | ||
| pull.collect(function (err, ary) { | ||
| t.equal(ary.map(String).join(''), 'done') | ||
| t.end() | ||
| }) | ||
| ) | ||
@@ -36,0 +42,0 @@ }, 200) |
+1
-1
@@ -26,5 +26,5 @@ | ||
| if(err) throw err | ||
| console.log('VALID END') | ||
| // console.log('VALID END') | ||
| process.exit() | ||
| }) | ||
| ) |
+11
-9
@@ -24,14 +24,16 @@ var pull = require('pull-stream') | ||
| toPull(new Counter()) | ||
| .pipe(pull.asyncMap(function (value, done) { | ||
| process.nextTick(function() { | ||
| done(null, value) | ||
| pull( | ||
| toPull(new Counter()), | ||
| pull.asyncMap(function (value, done) { | ||
| process.nextTick(function() { | ||
| done(null, value) | ||
| }) | ||
| }), | ||
| pull.collect(function (err, values) { | ||
| t.deepEqual(values, [1, 2, 3, 4, 5]) | ||
| t.end() | ||
| }) | ||
| })) | ||
| .pipe(pull.collect(function (err, values) { | ||
| t.deepEqual(values, [1, 2, 3, 4, 5]) | ||
| t.end() | ||
| })) | ||
| ) | ||
| }) | ||
| } |
@@ -15,3 +15,5 @@ | ||
| var child = cp.spawn(process.execPath, [require.resolve('./stdout')]) | ||
| child.on('exit', function () { | ||
| console.log('ended') | ||
| }) | ||
| pull( | ||
@@ -23,6 +25,6 @@ toPull.source(child.stdout), | ||
| try { | ||
| JSON.parse(e) | ||
| return JSON.parse(e) | ||
| } catch (err) { | ||
| console.log(JSON.stringify(e)) | ||
| throw err | ||
| //throw err | ||
| } | ||
@@ -34,5 +36,6 @@ | ||
| cb(null, data) | ||
| }, 100) | ||
| }, 10) | ||
| }), | ||
| pull.drain(null, function (err) { | ||
| console.log('DONE') | ||
| if(err) throw err | ||
@@ -42,1 +45,2 @@ console.log('done') | ||
| ) | ||
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
13191
1.35%438
3.79%