mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 09:01:45 +08:00
56 lines
1.1 KiB
TypeScript
56 lines
1.1 KiB
TypeScript
|
|
/// <reference types="node" />
|
|
|
|
import through2 = require('through2');
|
|
|
|
var rws: NodeJS.ReadWriteStream;
|
|
|
|
rws = through2({
|
|
objectMode: true,
|
|
allowHalfOpen: true
|
|
}, function (entry: any, enc: string, callback: () => void) {
|
|
this.push('foo');
|
|
callback();
|
|
}, () => {
|
|
|
|
});
|
|
|
|
rws = through2(function (entry: any, enc: string, callback: () => void) {
|
|
this.push('foo');
|
|
callback();
|
|
}, () => {
|
|
|
|
});
|
|
|
|
rws = through2(function (entry: any, enc: string, callback: (error: any, data?: any) => void) {
|
|
callback(null, 'foo');
|
|
}, (flushCallback: () => void) => {
|
|
flushCallback();
|
|
});
|
|
|
|
rws = through2(function (entry: any, enc: string, callback: () => void) {
|
|
this.push('foo');
|
|
callback();
|
|
});
|
|
|
|
rws = through2();
|
|
|
|
// obj
|
|
rws = through2.obj(function (entry: any, enc: string, callback: () => void) {
|
|
this.push('foo');
|
|
callback();
|
|
}, () => {
|
|
|
|
});
|
|
|
|
rws = through2.obj(function (entry: any, enc: string, callback: () => void) {
|
|
this.push('foo');
|
|
callback();
|
|
});
|
|
|
|
rws = through2.obj(function (entry: any, enc: string, callback: (err: any) => void) {
|
|
callback('Oups!');
|
|
}, (flashCallback) => {
|
|
flashCallback();
|
|
});
|