1 | # Installation
|
2 | > `npm install --save @types/from2`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for from2 (https://github.com/hughsk/from2).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/from2.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/from2/index.d.ts)
|
10 | ````ts
|
11 | // Type definitions for from2 2.3
|
12 | // Project: https://github.com/hughsk/from2
|
13 | // Definitions by: BendingBender <https://github.com/BendingBender>
|
14 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
15 |
|
16 | /// <reference types="node" />
|
17 | import * as stream from 'stream';
|
18 |
|
19 | export = from2;
|
20 |
|
21 | declare function from2(read: from2.ReadInput): from2.Stream;
|
22 | declare function from2(opts: from2.ObjectModeOptions, read: from2.ReadObjectInput): from2.Stream;
|
23 | declare function from2(opts: from2.Options, read: from2.ReadInput): from2.Stream;
|
24 |
|
25 | declare namespace from2 {
|
26 | interface Stream extends NodeJS.ReadableStream {
|
27 | readonly destroyed: boolean;
|
28 | destroy: (err?: Error) => void;
|
29 | }
|
30 | function obj(read: ReadObjectInput): Stream;
|
31 | function obj(opts: { objectMode?: true | undefined } & stream.ReadableOptions, read: ReadObjectInput): Stream;
|
32 |
|
33 | function ctor(opts?: Options): From2Ctor<ReadInput>;
|
34 | function ctor(opts: ObjectModeOptions): From2Ctor<ReadObjectInput>;
|
35 |
|
36 | type ObjectModeOptions = { objectMode: true } & stream.ReadableOptions;
|
37 | type Options = { objectMode?: false | undefined } & stream.ReadableOptions;
|
38 |
|
39 | type From2Ctor<R extends ReadInput | ReadObjectInput> = new (read: R) => Stream;
|
40 |
|
41 | type ReadObjectInput = ReadCallback<NextObjectCallback> | any[];
|
42 | type ReadInput = ReadCallback<NextCallback> | Chunk[];
|
43 | type ReadCallback<N extends NextCallback | NextObjectCallback> = (size: number, next: N) => void;
|
44 | type NextCallback = (err: any | undefined, chunk: Chunk) => void;
|
45 | type NextObjectCallback = (err: any | undefined, chunk: any) => void;
|
46 | type Chunk = string | Buffer | Uint8Array | null;
|
47 | }
|
48 |
|
49 | ````
|
50 |
|
51 | ### Additional Details
|
52 | * Last updated: Wed, 09 Nov 2022 15:02:58 GMT
|
53 | * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
54 | * Global values: none
|
55 |
|
56 | # Credits
|
57 | These definitions were written by [BendingBender](https://github.com/BendingBender).
|
58 |
|
\ | No newline at end of file |