-
-
Save brycebaril/f608f633307329feb779 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spigot = require("stream-spigot") | |
var through2 = require("through2") | |
var terminus = require("terminus") | |
var mb = require("multibuffer") | |
var count = 0 | |
spigot(function () { | |
if (count++ < 3) { | |
this.push(new Uint8Array()) | |
} | |
else { | |
this.push(null) | |
} | |
}) | |
.pipe(through2(function (chunk, encoding, callback) { | |
var zz = mb.pack([chunk]) | |
console.log(zz) | |
this.push(mb.pack([chunk])) | |
callback() | |
})) | |
.pipe(through2(function (chunk, encoding, callback) { | |
this.push(mb.unpack(chunk)[0]) | |
callback() | |
})) | |
.pipe(terminus.tail(function (piece) { | |
console.log("got: " + piece.toString()) | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment