Files
DefinitelyTyped/concat-stream/concat-stream-tests.ts
2017-02-23 07:15:16 -08:00

21 lines
438 B
TypeScript

import concat = require("concat-stream");
import { Readable } from "stream";
class MyReadable extends Readable {
i: number = 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())));