Add buffer support to split, join, replace and parse streams

This commit is contained in:
Sami Turcotte
2018-12-03 09:18:49 -05:00
parent 407bb79260
commit 63c3681211
4 changed files with 53 additions and 9 deletions

12
samples/split.js Normal file
View File

@@ -0,0 +1,12 @@
const mhysa = require("mhysa");
let 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();