strom/samples/concat.js

16 lines
365 B
JavaScript
Raw Normal View History

2018-12-04 06:30:38 +00:00
const { Readable } = require("stream");
2018-11-29 04:59:24 +00:00
const Mhysa = require("mhysa");
2018-11-26 01:00:37 +00:00
2018-12-04 06:30:38 +00:00
const source1 = new Readable();
const source2 = new Readable();
const expectedElements = ["a", "b", "c", "d"];
let i = 0;
Mhysa.concat(source1, source2).pipe(process.stdout);
2018-11-26 01:00:37 +00:00
2018-12-04 06:30:38 +00:00
source1.push("a");
source2.push("c");
source1.push("b");
source2.push("d");
source1.push(null);
source2.push(null);