-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.d.ts
172 lines (146 loc) · 4.45 KB
/
index.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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
export class ReadableStream<R> {
[Symbol.asyncIterator](): AsyncIterator<R>;
readonly locked: boolean;
constructor(
underlyingSource?: UnderlyingSource<R>,
strategy?: QueuingStrategy<R>
);
cancel(reason?: any): Promise<void>;
getReader(): ReadableStreamDefaultReader<R>;
pipeThrough<T>(
transform: ReadableWritablePair<T, R>,
options?: StreamPipeOptions
): ReadableStream<T>;
pipeTo(dest: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
tee(): [ReadableStream<R>, ReadableStream<R>];
}
export class ReadableStreamDefaultReader<R> {
read(): Promise<ReadableStreamDefaultReadResult<R>>;
releaseLock(): void;
}
export class ReadableStreamBYOBReader {}
export class ReadableStreamBYOBRequest {}
export class ReadableByteStreamController {}
export class ReadableStreamDefaultController<R> {
readonly desiredSize: number | null;
close(): void;
enqueue(chunk: R): void;
error(e?: any): void;
}
export class TransformStream<I, O> implements ReadableWritablePair<O, I> {
readonly readable: ReadableStream<O>;
readonly writable: WritableStream<I>;
constructor(
transformer?: Transformer<I, O>,
writableStrategy?: QueuingStrategy<I>,
readableStrategy?: QueuingStrategy<O>
);
}
export class TransformStreamDefaultController<O> {
readonly desiredSize: number | null;
enqueue(chunk: O): void;
error(reason?: any): void;
terminate(): void;
}
export class WritableStream<W> {
readonly locked: boolean;
constructor(
underlyingSink?: UnderlyingSink<W>,
strategy?: QueuingStrategy<W>
);
abort(reason?: any): Promise<void>;
getWriter(): WritableStreamDefaultWriter<W>;
}
export class WritableStreamDefaultWriter<W> {
readonly closed: Promise<undefined>;
readonly desiredSize: number | null;
readonly ready: Promise<undefined>;
constructor(stream: WritableStream<W>);
abort(reason?: any): Promise<void>;
close(): Promise<void>;
releaseLock(): void;
write(chunk: W): Promise<void>;
}
export class WritableStreamDefaultController {
error(e?: any): void;
}
export class ByteLengthQueuingStrategy
implements QueuingStrategy<ArrayBufferView>
{
readonly highWaterMark: number;
constructor(init: QueuingStrategyInit);
size(chunk: ArrayBufferView): number;
}
export class CountQueuingStrategy implements QueuingStrategy<any> {
readonly highWaterMark: number;
constructor(init: QueuingStrategyInit);
size(chunk: any): number;
}
export class TextEncoderStream
implements ReadableWritablePair<Uint8Array, string>
{
readonly readable: ReadableStream<Uint8Array>;
readonly writable: WritableStream<string>;
}
export class TextDecoderStream
implements ReadableWritablePair<string, BufferSource>
{
readonly readable: ReadableStream<string>;
readonly writable: WritableStream<BufferSource>;
constructor(label?: string, options?: TextDecoderOptions);
}
export type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
export type ReadableStreamDefaultReadResult<T> =
| ReadableStreamDefaultReadValueResult<T>
| ReadableStreamDefaultReadDoneResult;
interface TextDecoderOptions {
fatal?: boolean;
ignoreBOM?: boolean;
}
interface ReadableWritablePair<R, W> {
readable: ReadableStream<R>;
writable: WritableStream<W>;
}
export interface UnderlyingSource<R> {
type?: "bytes" | undefined;
cancel?(reason: any): void | PromiseLike<void>;
pull?(controller: ReadableStreamController<R>): void | PromiseLike<void>;
start?(controller: ReadableStreamController<R>): void | PromiseLike<void>;
}
export interface UnderlyingSink<W> {
type?: "bytes" | undefined;
abort?(reason?: any): void | PromiseLike<void>;
close?(): void | PromiseLike<void>;
start?(controller: WritableStreamDefaultController): any;
write?(
chunk: W,
controller: WritableStreamDefaultController
): void | PromiseLike<void>;
}
export interface StreamPipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
preventClose?: boolean;
signal?: AbortSignal;
}
export interface TransformStreamTransformer<T, R> {
transform(chunk: R, controller: TransformerController<T, R>): any;
}
export interface TransformerController<T, R> {
enqueue(value: T): void;
}
export interface ReadableStreamDefaultReadDoneResult {
done: true;
value?: undefined;
}
export interface ReadableStreamDefaultReadValueResult<T> {
done: false;
value: T;
}
export interface QueuingStrategy<T> {
highWaterMark?: number;
size?(chunk: T): number;
}
interface QueuingStrategyInit {
highWaterMark: number;
}