strom/samples/split.js

13 lines
257 B
JavaScript
Raw Normal View History

2018-12-03 14:30:58 +00:00
const Mhysa = require("mhysa");
2018-12-03 14:30:58 +00:00
const stream = Mhysa.split(",");
const buf = Buffer.from("a,b,c");
stream.on("data", function(data) {
console.log(data);
});
for (let i = 0; i < buf.length; ++i) {
stream.write(buf.slice(i, i + 1));
}
stream.end();