forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththrough2.d.ts
40 lines (29 loc) · 1.52 KB
/
through2.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Type definitions for through2 v 2.0.0
// Project: https://github.com/rvagg/through2
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, jedmao <https://github.com/jedmao>, Georgios Valotasios <https://github.com/valotas>, Ben Chauvette <https://github.com/bdchauvette>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'through2' {
import stream = require('stream');
type TransformCallback = (err?: any, data?: any) => void;
type TransformFunction = (chunk: any, enc: string, callback: TransformCallback) => void;
type FlushCallback = (flushCallback: () => void) => void;
function through2(transform?: TransformFunction, flush?: FlushCallback): stream.Transform;
function through2(opts?: stream.DuplexOptions, transform?: TransformFunction, flush?: FlushCallback): stream.Transform;
namespace through2 {
export interface Through2Constructor extends stream.Transform {
new(opts?: stream.DuplexOptions): stream.Transform;
(opts?: stream.DuplexOptions): stream.Transform;
}
/**
* Convenvience method for creating object streams
*/
export function obj(transform?: TransformFunction, flush?: FlushCallback): stream.Transform;
/**
* Creates a constructor for a custom Transform. This is useful when you
* want to use the same transform logic in multiple instances.
*/
export function ctor(opts?: stream.DuplexOptions, transfrom?: TransformFunction, flush?: FlushCallback): Through2Constructor;
}
export = through2;
}