DefinitelyTyped/types/concat-stream/concat-stream-tests.ts
2017-08-17 14:53:41 -07:00

21 lines
430 B
TypeScript

import concat = require("concat-stream");
import { Readable } from "stream";
class MyReadable extends Readable {
i = 1;
_read() {
if (this.i <= 100) {
this.push(this.i.toString());
this.i++;
} else {
this.push(null);
}
}
}
const myReadable = new MyReadable();
myReadable.pipe(concat((buf) => console.log(buf.toString())));
myReadable.pipe(concat({}, (buf) => console.log(buf.toString())));