mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
21 lines
430 B
TypeScript
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())));
|