-
Notifications
You must be signed in to change notification settings - Fork 266
/
index.d.cts
94 lines (84 loc) · 2.38 KB
/
index.d.cts
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/// <reference types="node" />
import * as stream from "stream";
type Callback = (err?: Error, records?: any) => void;
export class Generator extends stream.Readable {
constructor(options?: Options);
readonly options: Options;
}
export type ColumnsFunctionArgs = {
options: Options;
state: State;
};
export type ColumnsFunction = (args: ColumnsFunctionArgs) => string;
export type State = {
start_time: number,
fixed_size_buffer: number,
count_written: number,
count_created: number,
}
export interface Options extends stream.ReadableOptions {
/**
* Define the number of generated fields and the generation method.
*/
columns?: number | (string | ColumnsFunction)[];
/**
* Set the field delimiter.
*/
delimiter?: string;
/**
* Period to run in milliseconds.
*/
duration?: number;
/**
* If specified, then buffers will be decoded to strings using the specified encoding.
*/
encoding?: BufferEncoding | undefined;
/**
* When to stop the generation.
*/
end?: number | Date;
/**
* One or multiple characters to print at the end of the file; only apply when objectMode is disabled.
*/
eof?: boolean | string;
/**
* Generate buffers equals length as defined by the `highWaterMark` option.
*/
fixed_size?: boolean;
fixedSize?: boolean;
/**
* The maximum number of bytes to store in the internal buffer before ceasing to read from the underlying resource.
*/
high_water_mark?: number;
highWaterMark?: number;
/**
* Number of lines or records to generate.
*/
length?: number;
/**
* Maximum number of characters per word.
*/
max_word_length?: number;
maxWordLength?: number;
/**
* Whether this stream should behave as a stream of objects.
*/
object_mode?: boolean
objectMode?: boolean;
/**
* One or multiple characters used to delimit records.
*/
row_delimiter?: string;
/**
* Generate idempotent random characters if a number provided.
*/
seed?: boolean | number;
/**
* The time to wait between the generation of each records
*/
sleep?: number;
}
declare function generate(options?: Options, callback?: Callback): Generator;
declare function generate(callback?: Callback): Generator;
// export default generate;
export {generate};