mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-12 12:10:44 +08:00
added defs for some (stream) utils
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
/// <reference path="./through2.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
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: () => 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();
|
||||
});
|
||||
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// Type definitions for through2 v 0.4.2
|
||||
// Project: https://github.com/rvagg/through2
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'through2' {
|
||||
import stream = require('stream');
|
||||
|
||||
var mod: mod.Through2;
|
||||
|
||||
module mod {
|
||||
interface Through2 {
|
||||
(transform?: (entry: any, enc: string, callback: () => void) => void, flush?: () => void): NodeJS.ReadWriteStream;
|
||||
(opts: stream.DuplexOptions, transform?: (entry: any, enc: string, callback: () => void) => void, flush?: () => void): NodeJS.ReadWriteStream;
|
||||
obj(transform: (entry: any, enc: string, callback: () => void) => void, flush?: () => void): NodeJS.ReadWriteStream;
|
||||
push(data: any): void;
|
||||
}
|
||||
}
|
||||
export = mod;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user