Files: d2f2697f296dd39aed6a8b63c6d04a736a7db5b3 / node_modules / stream-to-pull-stream / test / close.js
506 bytesRaw
1 | var pull = require('pull-stream') |
2 | var through = require('through') |
3 | var toPull = require('../') |
4 | |
5 | require('tape')('propagate close back to source', function (t) { |
6 | |
7 | t.plan(1) |
8 | |
9 | var i = 0 |
10 | |
11 | var ts = through(function (data) { |
12 | console.log(data) |
13 | if(i++ > 100) |
14 | ts.destroy() |
15 | }) |
16 | |
17 | pull( |
18 | pull.infinite(), |
19 | function (read) { |
20 | return function (abort, cb) { |
21 | if(abort) return t.ok(true), t.end() |
22 | read(false, cb) |
23 | } |
24 | }, |
25 | toPull(ts), |
26 | pull.drain() |
27 | ) |
28 | |
29 | }) |
30 |
Built with git-ssb-web