@types/node 16.11.39 → 18.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {node v16.11 → node}/LICENSE +0 -0
- node v16.11/README.md → node/README.md +4 -4
- {node v16.11 → node}/assert/strict.d.ts +0 -0
- node v16.11/assert.d.ts → node/assert.d.ts +7 -8
- node v16.11/async_hooks.d.ts → node/async_hooks.d.ts +8 -4
- node/buffer.d.ts +2258 -0
- node v16.11/child_process.d.ts → node/child_process.d.ts +6 -3
- node v16.11/cluster.d.ts → node/cluster.d.ts +14 -18
- node v16.11/console.d.ts → node/console.d.ts +1 -1
- {node v16.11 → node}/constants.d.ts +0 -0
- node v16.11/crypto.d.ts → node/crypto.d.ts +679 -53
- node v16.11/dgram.d.ts → node/dgram.d.ts +3 -3
- node v16.11/diagnostics_channel.d.ts → node/diagnostics_channel.d.ts +2 -1
- node v16.11/dns/promises.d.ts → node/dns/promises.d.ts +10 -8
- node v16.11/dns.d.ts → node/dns.d.ts +16 -11
- node/dom-events.d.ts +126 -0
- node v16.11/domain.d.ts → node/domain.d.ts +3 -2
- node v16.11/events.d.ts → node/events.d.ts +65 -10
- node v16.11/fs/promises.d.ts → node/fs/promises.d.ts +86 -39
- node v16.11/fs.d.ts → node/fs.d.ts +149 -67
- node/globals.d.ts +300 -0
- {node v16.11 → node}/globals.global.d.ts +0 -0
- node v16.11/http.d.ts → node/http.d.ts +305 -77
- node v16.11/http2.d.ts → node/http2.d.ts +38 -5
- node v16.11/https.d.ts → node/https.d.ts +209 -59
- node v16.11/index.d.ts → node/index.d.ts +6 -3
- node v16.11/inspector.d.ts → node/inspector.d.ts +11 -15
- {node v16.11 → node}/module.d.ts +0 -0
- node v16.11/net.d.ts → node/net.d.ts +94 -21
- node v16.11/os.d.ts → node/os.d.ts +15 -4
- node v16.11/package.json → node/package.json +15 -8
- node v16.11/path.d.ts → node/path.d.ts +34 -23
- node v16.11/perf_hooks.d.ts → node/perf_hooks.d.ts +76 -8
- node v16.11/process.d.ts → node/process.d.ts +17 -16
- node v16.11/punycode.d.ts → node/punycode.d.ts +1 -1
- node v16.11/querystring.d.ts → node/querystring.d.ts +4 -4
- node/readline/promises.d.ts +143 -0
- node v16.11/readline.d.ts → node/readline.d.ts +140 -30
- node v16.11/repl.d.ts → node/repl.d.ts +2 -2
- node v16.11/stream/consumers.d.ts → node/stream/consumers.d.ts +2 -14
- {node v16.11 → node}/stream/promises.d.ts +0 -0
- node v16.11/stream/web.d.ts → node/stream/web.d.ts +3 -65
- node v16.11/stream.d.ts → node/stream.d.ts +97 -19
- node v16.11/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
- node/test.d.ts +314 -0
- {node v16.11 → node}/timers/promises.d.ts +0 -0
- node v16.11/timers.d.ts → node/timers.d.ts +1 -1
- node v16.11/tls.d.ts → node/tls.d.ts +32 -23
- node v16.11/trace_events.d.ts → node/trace_events.d.ts +11 -1
- node/ts4.8/assert/strict.d.ts +8 -0
- node/ts4.8/assert.d.ts +911 -0
- node/ts4.8/async_hooks.d.ts +501 -0
- node v16.11/buffer.d.ts → node/ts4.8/buffer.d.ts +46 -19
- node/ts4.8/child_process.d.ts +1369 -0
- node/ts4.8/cluster.d.ts +410 -0
- node/ts4.8/console.d.ts +412 -0
- node/ts4.8/constants.d.ts +18 -0
- node/ts4.8/crypto.d.ts +3964 -0
- node/ts4.8/dgram.d.ts +545 -0
- node/ts4.8/diagnostics_channel.d.ts +153 -0
- node/ts4.8/dns/promises.d.ts +370 -0
- node/ts4.8/dns.d.ts +659 -0
- node/ts4.8/dom-events.d.ts +126 -0
- node/ts4.8/domain.d.ts +170 -0
- node/ts4.8/events.d.ts +678 -0
- node/ts4.8/fs/promises.d.ts +1138 -0
- node/ts4.8/fs.d.ts +3872 -0
- node v16.11/globals.d.ts → node/ts4.8/globals.d.ts +14 -4
- node/ts4.8/globals.global.d.ts +1 -0
- node/ts4.8/http.d.ts +1607 -0
- node/ts4.8/http2.d.ts +2134 -0
- node/ts4.8/https.d.ts +541 -0
- node/ts4.8/index.d.ts +88 -0
- node/ts4.8/inspector.d.ts +2741 -0
- node/ts4.8/module.d.ts +114 -0
- node/ts4.8/net.d.ts +869 -0
- node/ts4.8/os.d.ts +466 -0
- node/ts4.8/path.d.ts +191 -0
- node/ts4.8/perf_hooks.d.ts +625 -0
- node/ts4.8/process.d.ts +1482 -0
- node/ts4.8/punycode.d.ts +117 -0
- node/ts4.8/querystring.d.ts +131 -0
- node/ts4.8/readline/promises.d.ts +143 -0
- node/ts4.8/readline.d.ts +653 -0
- node/ts4.8/repl.d.ts +424 -0
- node/ts4.8/stream/consumers.d.ts +12 -0
- node/ts4.8/stream/promises.d.ts +42 -0
- node/ts4.8/stream/web.d.ts +330 -0
- node/ts4.8/stream.d.ts +1340 -0
- node/ts4.8/string_decoder.d.ts +67 -0
- node/ts4.8/test.d.ts +314 -0
- node/ts4.8/timers/promises.d.ts +68 -0
- node/ts4.8/timers.d.ts +94 -0
- node/ts4.8/tls.d.ts +1028 -0
- node/ts4.8/trace_events.d.ts +171 -0
- node v16.11/tty.d.ts → node/ts4.8/tty.d.ts +4 -2
- node v16.11/url.d.ts → node/ts4.8/url.d.ts +85 -39
- node v16.11/util.d.ts → node/ts4.8/util.d.ts +268 -12
- node v16.11/v8.d.ts → node/ts4.8/v8.d.ts +21 -3
- node v16.11/vm.d.ts → node/ts4.8/vm.d.ts +6 -4
- node v16.11/wasi.d.ts → node/ts4.8/wasi.d.ts +1 -1
- node v16.11/worker_threads.d.ts → node/ts4.8/worker_threads.d.ts +50 -10
- node v16.11/zlib.d.ts → node/ts4.8/zlib.d.ts +1 -1
- node/tty.d.ts +206 -0
- node/url.d.ts +897 -0
- node/util.d.ts +1850 -0
- node/v8.d.ts +396 -0
- node/vm.d.ts +509 -0
- node/wasi.d.ts +158 -0
- node/worker_threads.d.ts +689 -0
- node/zlib.d.ts +517 -0
|
@@ -1,36 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time.
|
|
3
|
-
*
|
|
2
|
+
* The `readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time.
|
|
3
|
+
*
|
|
4
|
+
* To use the promise-based APIs:
|
|
4
5
|
*
|
|
5
6
|
* ```js
|
|
6
|
-
*
|
|
7
|
+
* import * as readline from 'node:readline/promises';
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* To use the callback and sync APIs:
|
|
11
|
+
*
|
|
12
|
+
* ```js
|
|
13
|
+
* import * as readline from 'node:readline';
|
|
7
14
|
* ```
|
|
8
15
|
*
|
|
9
16
|
* The following simple example illustrates the basic use of the `readline` module.
|
|
10
17
|
*
|
|
11
18
|
* ```js
|
|
12
|
-
*
|
|
19
|
+
* import * as readline from 'node:readline/promises';
|
|
20
|
+
* import { stdin as input, stdout as output } from 'node:process';
|
|
21
|
+
*
|
|
22
|
+
* const rl = readline.createInterface({ input, output });
|
|
13
23
|
*
|
|
14
|
-
* const
|
|
15
|
-
* input: process.stdin,
|
|
16
|
-
* output: process.stdout
|
|
17
|
-
* });
|
|
24
|
+
* const answer = await rl.question('What do you think of Node.js? ');
|
|
18
25
|
*
|
|
19
|
-
*
|
|
20
|
-
* // TODO: Log the answer in a database
|
|
21
|
-
* console.log(`Thank you for your valuable feedback: ${answer}`);
|
|
26
|
+
* console.log(`Thank you for your valuable feedback: ${answer}`);
|
|
22
27
|
*
|
|
23
|
-
*
|
|
24
|
-
* });
|
|
28
|
+
* rl.close();
|
|
25
29
|
* ```
|
|
26
30
|
*
|
|
27
31
|
* Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be
|
|
28
32
|
* received on the `input` stream.
|
|
29
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
33
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/readline.js)
|
|
30
34
|
*/
|
|
31
35
|
declare module 'readline' {
|
|
32
36
|
import { Abortable, EventEmitter } from 'node:events';
|
|
33
|
-
|
|
37
|
+
import * as promises from 'node:readline/promises';
|
|
38
|
+
|
|
39
|
+
export { promises };
|
|
40
|
+
export interface Key {
|
|
34
41
|
sequence?: string | undefined;
|
|
35
42
|
name?: string | undefined;
|
|
36
43
|
ctrl?: boolean | undefined;
|
|
@@ -44,7 +51,7 @@ declare module 'readline' {
|
|
|
44
51
|
* and is read from, the `input` stream.
|
|
45
52
|
* @since v0.1.104
|
|
46
53
|
*/
|
|
47
|
-
class Interface extends EventEmitter {
|
|
54
|
+
export class Interface extends EventEmitter {
|
|
48
55
|
readonly terminal: boolean;
|
|
49
56
|
/**
|
|
50
57
|
* The current input data being processed by node.
|
|
@@ -311,11 +318,11 @@ declare module 'readline' {
|
|
|
311
318
|
prependOnceListener(event: 'history', listener: (history: string[]) => void): this;
|
|
312
319
|
[Symbol.asyncIterator](): AsyncIterableIterator<string>;
|
|
313
320
|
}
|
|
314
|
-
type ReadLine = Interface; // type forwarded for backwards compatibility
|
|
315
|
-
type Completer = (line: string) => CompleterResult;
|
|
316
|
-
type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => void;
|
|
317
|
-
type CompleterResult = [string[], string];
|
|
318
|
-
interface ReadLineOptions {
|
|
321
|
+
export type ReadLine = Interface; // type forwarded for backwards compatibility
|
|
322
|
+
export type Completer = (line: string) => CompleterResult;
|
|
323
|
+
export type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => void;
|
|
324
|
+
export type CompleterResult = [string[], string];
|
|
325
|
+
export interface ReadLineOptions {
|
|
319
326
|
input: NodeJS.ReadableStream;
|
|
320
327
|
output?: NodeJS.WritableStream | undefined;
|
|
321
328
|
completer?: Completer | AsyncCompleter | undefined;
|
|
@@ -376,8 +383,8 @@ declare module 'readline' {
|
|
|
376
383
|
* ```
|
|
377
384
|
* @since v0.1.98
|
|
378
385
|
*/
|
|
379
|
-
function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
|
|
380
|
-
function createInterface(options: ReadLineOptions): Interface;
|
|
386
|
+
export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
|
|
387
|
+
export function createInterface(options: ReadLineOptions): Interface;
|
|
381
388
|
/**
|
|
382
389
|
* The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input.
|
|
383
390
|
*
|
|
@@ -394,11 +401,114 @@ declare module 'readline' {
|
|
|
394
401
|
* if (process.stdin.isTTY)
|
|
395
402
|
* process.stdin.setRawMode(true);
|
|
396
403
|
* ```
|
|
404
|
+
*
|
|
405
|
+
* ## Example: Tiny CLI
|
|
406
|
+
*
|
|
407
|
+
* The following example illustrates the use of `readline.Interface` class to
|
|
408
|
+
* implement a small command-line interface:
|
|
409
|
+
*
|
|
410
|
+
* ```js
|
|
411
|
+
* const readline = require('readline');
|
|
412
|
+
* const rl = readline.createInterface({
|
|
413
|
+
* input: process.stdin,
|
|
414
|
+
* output: process.stdout,
|
|
415
|
+
* prompt: 'OHAI> '
|
|
416
|
+
* });
|
|
417
|
+
*
|
|
418
|
+
* rl.prompt();
|
|
419
|
+
*
|
|
420
|
+
* rl.on('line', (line) => {
|
|
421
|
+
* switch (line.trim()) {
|
|
422
|
+
* case 'hello':
|
|
423
|
+
* console.log('world!');
|
|
424
|
+
* break;
|
|
425
|
+
* default:
|
|
426
|
+
* console.log(`Say what? I might have heard '${line.trim()}'`);
|
|
427
|
+
* break;
|
|
428
|
+
* }
|
|
429
|
+
* rl.prompt();
|
|
430
|
+
* }).on('close', () => {
|
|
431
|
+
* console.log('Have a great day!');
|
|
432
|
+
* process.exit(0);
|
|
433
|
+
* });
|
|
434
|
+
* ```
|
|
435
|
+
*
|
|
436
|
+
* ## Example: Read file stream line-by-Line
|
|
437
|
+
*
|
|
438
|
+
* A common use case for `readline` is to consume an input file one line at a
|
|
439
|
+
* time. The easiest way to do so is leveraging the `fs.ReadStream` API as
|
|
440
|
+
* well as a `for await...of` loop:
|
|
441
|
+
*
|
|
442
|
+
* ```js
|
|
443
|
+
* const fs = require('fs');
|
|
444
|
+
* const readline = require('readline');
|
|
445
|
+
*
|
|
446
|
+
* async function processLineByLine() {
|
|
447
|
+
* const fileStream = fs.createReadStream('input.txt');
|
|
448
|
+
*
|
|
449
|
+
* const rl = readline.createInterface({
|
|
450
|
+
* input: fileStream,
|
|
451
|
+
* crlfDelay: Infinity
|
|
452
|
+
* });
|
|
453
|
+
* // Note: we use the crlfDelay option to recognize all instances of CR LF
|
|
454
|
+
* // ('\r\n') in input.txt as a single line break.
|
|
455
|
+
*
|
|
456
|
+
* for await (const line of rl) {
|
|
457
|
+
* // Each line in input.txt will be successively available here as `line`.
|
|
458
|
+
* console.log(`Line from file: ${line}`);
|
|
459
|
+
* }
|
|
460
|
+
* }
|
|
461
|
+
*
|
|
462
|
+
* processLineByLine();
|
|
463
|
+
* ```
|
|
464
|
+
*
|
|
465
|
+
* Alternatively, one could use the `'line'` event:
|
|
466
|
+
*
|
|
467
|
+
* ```js
|
|
468
|
+
* const fs = require('fs');
|
|
469
|
+
* const readline = require('readline');
|
|
470
|
+
*
|
|
471
|
+
* const rl = readline.createInterface({
|
|
472
|
+
* input: fs.createReadStream('sample.txt'),
|
|
473
|
+
* crlfDelay: Infinity
|
|
474
|
+
* });
|
|
475
|
+
*
|
|
476
|
+
* rl.on('line', (line) => {
|
|
477
|
+
* console.log(`Line from file: ${line}`);
|
|
478
|
+
* });
|
|
479
|
+
* ```
|
|
480
|
+
*
|
|
481
|
+
* Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
|
|
482
|
+
*
|
|
483
|
+
* ```js
|
|
484
|
+
* const { once } = require('events');
|
|
485
|
+
* const { createReadStream } = require('fs');
|
|
486
|
+
* const { createInterface } = require('readline');
|
|
487
|
+
*
|
|
488
|
+
* (async function processLineByLine() {
|
|
489
|
+
* try {
|
|
490
|
+
* const rl = createInterface({
|
|
491
|
+
* input: createReadStream('big-file.txt'),
|
|
492
|
+
* crlfDelay: Infinity
|
|
493
|
+
* });
|
|
494
|
+
*
|
|
495
|
+
* rl.on('line', (line) => {
|
|
496
|
+
* // Process the line.
|
|
497
|
+
* });
|
|
498
|
+
*
|
|
499
|
+
* await once(rl, 'close');
|
|
500
|
+
*
|
|
501
|
+
* console.log('File processed.');
|
|
502
|
+
* } catch (err) {
|
|
503
|
+
* console.error(err);
|
|
504
|
+
* }
|
|
505
|
+
* })();
|
|
506
|
+
* ```
|
|
397
507
|
* @since v0.7.7
|
|
398
508
|
*/
|
|
399
|
-
function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
|
|
400
|
-
type Direction = -1 | 0 | 1;
|
|
401
|
-
interface CursorPos {
|
|
509
|
+
export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
|
|
510
|
+
export type Direction = -1 | 0 | 1;
|
|
511
|
+
export interface CursorPos {
|
|
402
512
|
rows: number;
|
|
403
513
|
cols: number;
|
|
404
514
|
}
|
|
@@ -409,7 +519,7 @@ declare module 'readline' {
|
|
|
409
519
|
* @param callback Invoked once the operation completes.
|
|
410
520
|
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
|
411
521
|
*/
|
|
412
|
-
function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
|
|
522
|
+
export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
|
|
413
523
|
/**
|
|
414
524
|
* The `readline.clearScreenDown()` method clears the given `TTY` stream from
|
|
415
525
|
* the current position of the cursor down.
|
|
@@ -417,7 +527,7 @@ declare module 'readline' {
|
|
|
417
527
|
* @param callback Invoked once the operation completes.
|
|
418
528
|
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
|
419
529
|
*/
|
|
420
|
-
function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
|
|
530
|
+
export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
|
|
421
531
|
/**
|
|
422
532
|
* The `readline.cursorTo()` method moves cursor to the specified position in a
|
|
423
533
|
* given `TTY` `stream`.
|
|
@@ -425,7 +535,7 @@ declare module 'readline' {
|
|
|
425
535
|
* @param callback Invoked once the operation completes.
|
|
426
536
|
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
|
427
537
|
*/
|
|
428
|
-
function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
|
|
538
|
+
export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
|
|
429
539
|
/**
|
|
430
540
|
* The `readline.moveCursor()` method moves the cursor _relative_ to its current
|
|
431
541
|
* position in a given `TTY` `stream`.
|
|
@@ -536,7 +646,7 @@ declare module 'readline' {
|
|
|
536
646
|
* @param callback Invoked once the operation completes.
|
|
537
647
|
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
|
538
648
|
*/
|
|
539
|
-
function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
|
|
649
|
+
export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
|
|
540
650
|
}
|
|
541
651
|
declare module 'node:readline' {
|
|
542
652
|
export * from 'readline';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* ```js
|
|
7
7
|
* const repl = require('repl');
|
|
8
8
|
* ```
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/repl.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'repl' {
|
|
12
12
|
import { Interface, Completer, AsyncCompleter } from 'node:readline';
|
|
@@ -277,7 +277,7 @@ declare module 'repl' {
|
|
|
277
277
|
* Goodbye!
|
|
278
278
|
* ```
|
|
279
279
|
* @since v0.3.0
|
|
280
|
-
* @param keyword The command keyword (
|
|
280
|
+
* @param keyword The command keyword (_without_ a leading `.` character).
|
|
281
281
|
* @param cmd The function to invoke when the command is processed.
|
|
282
282
|
*/
|
|
283
283
|
defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void;
|
|
@@ -1,22 +1,10 @@
|
|
|
1
|
-
// Duplicates of interface in lib.dom.ts.
|
|
2
|
-
// Duplicated here rather than referencing lib.dom.ts because doing so causes lib.dom.ts to be loaded for "test-all"
|
|
3
|
-
// Which in turn causes tests to pass that shouldn't pass.
|
|
4
|
-
//
|
|
5
|
-
// This interface is not, and should not be, exported.
|
|
6
|
-
interface Blob {
|
|
7
|
-
readonly size: number;
|
|
8
|
-
readonly type: string;
|
|
9
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
10
|
-
slice(start?: number, end?: number, contentType?: string): Blob;
|
|
11
|
-
stream(): NodeJS.ReadableStream;
|
|
12
|
-
text(): Promise<string>;
|
|
13
|
-
}
|
|
14
1
|
declare module 'stream/consumers' {
|
|
2
|
+
import { Blob as NodeBlob } from "node:buffer";
|
|
15
3
|
import { Readable } from 'node:stream';
|
|
16
4
|
function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
|
|
17
5
|
function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
|
|
18
6
|
function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
|
|
19
|
-
function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<
|
|
7
|
+
function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<NodeBlob>;
|
|
20
8
|
function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<unknown>;
|
|
21
9
|
}
|
|
22
10
|
declare module 'node:stream/consumers' {
|
|
File without changes
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
declare module 'stream/web' {
|
|
2
2
|
// stub module, pending copy&paste from .d.ts or manual impl
|
|
3
3
|
// copy from lib.dom.d.ts
|
|
4
|
-
|
|
5
4
|
interface ReadableWritablePair<R = any, W = any> {
|
|
6
5
|
readable: ReadableStream<R>;
|
|
7
6
|
/**
|
|
@@ -15,7 +14,6 @@ declare module 'stream/web' {
|
|
|
15
14
|
*/
|
|
16
15
|
writable: WritableStream<W>;
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
interface StreamPipeOptions {
|
|
20
18
|
preventAbort?: boolean;
|
|
21
19
|
preventCancel?: boolean;
|
|
@@ -63,70 +61,53 @@ declare module 'stream/web' {
|
|
|
63
61
|
preventClose?: boolean;
|
|
64
62
|
signal?: AbortSignal;
|
|
65
63
|
}
|
|
66
|
-
|
|
67
64
|
interface ReadableStreamGenericReader {
|
|
68
65
|
readonly closed: Promise<undefined>;
|
|
69
66
|
cancel(reason?: any): Promise<void>;
|
|
70
67
|
}
|
|
71
|
-
|
|
72
68
|
interface ReadableStreamDefaultReadValueResult<T> {
|
|
73
69
|
done: false;
|
|
74
70
|
value: T;
|
|
75
71
|
}
|
|
76
|
-
|
|
77
72
|
interface ReadableStreamDefaultReadDoneResult {
|
|
78
73
|
done: true;
|
|
79
74
|
value?: undefined;
|
|
80
75
|
}
|
|
81
76
|
type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
|
|
82
|
-
type ReadableStreamDefaultReadResult<T> =
|
|
83
|
-
| ReadableStreamDefaultReadValueResult<T>
|
|
84
|
-
| ReadableStreamDefaultReadDoneResult;
|
|
85
|
-
|
|
77
|
+
type ReadableStreamDefaultReadResult<T> = ReadableStreamDefaultReadValueResult<T> | ReadableStreamDefaultReadDoneResult;
|
|
86
78
|
interface ReadableByteStreamControllerCallback {
|
|
87
79
|
(controller: ReadableByteStreamController): void | PromiseLike<void>;
|
|
88
80
|
}
|
|
89
|
-
|
|
90
81
|
interface UnderlyingSinkAbortCallback {
|
|
91
82
|
(reason?: any): void | PromiseLike<void>;
|
|
92
83
|
}
|
|
93
|
-
|
|
94
84
|
interface UnderlyingSinkCloseCallback {
|
|
95
85
|
(): void | PromiseLike<void>;
|
|
96
86
|
}
|
|
97
|
-
|
|
98
87
|
interface UnderlyingSinkStartCallback {
|
|
99
88
|
(controller: WritableStreamDefaultController): any;
|
|
100
89
|
}
|
|
101
|
-
|
|
102
90
|
interface UnderlyingSinkWriteCallback<W> {
|
|
103
91
|
(chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>;
|
|
104
92
|
}
|
|
105
|
-
|
|
106
93
|
interface UnderlyingSourceCancelCallback {
|
|
107
94
|
(reason?: any): void | PromiseLike<void>;
|
|
108
95
|
}
|
|
109
|
-
|
|
110
96
|
interface UnderlyingSourcePullCallback<R> {
|
|
111
97
|
(controller: ReadableStreamController<R>): void | PromiseLike<void>;
|
|
112
98
|
}
|
|
113
|
-
|
|
114
99
|
interface UnderlyingSourceStartCallback<R> {
|
|
115
100
|
(controller: ReadableStreamController<R>): any;
|
|
116
101
|
}
|
|
117
|
-
|
|
118
102
|
interface TransformerFlushCallback<O> {
|
|
119
103
|
(controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
|
120
104
|
}
|
|
121
|
-
|
|
122
105
|
interface TransformerStartCallback<O> {
|
|
123
106
|
(controller: TransformStreamDefaultController<O>): any;
|
|
124
107
|
}
|
|
125
|
-
|
|
126
108
|
interface TransformerTransformCallback<I, O> {
|
|
127
109
|
(chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
|
128
110
|
}
|
|
129
|
-
|
|
130
111
|
interface UnderlyingByteSource {
|
|
131
112
|
autoAllocateChunkSize?: number;
|
|
132
113
|
cancel?: ReadableStreamErrorCallback;
|
|
@@ -134,14 +115,12 @@ declare module 'stream/web' {
|
|
|
134
115
|
start?: ReadableByteStreamControllerCallback;
|
|
135
116
|
type: 'bytes';
|
|
136
117
|
}
|
|
137
|
-
|
|
138
118
|
interface UnderlyingSource<R = any> {
|
|
139
119
|
cancel?: UnderlyingSourceCancelCallback;
|
|
140
120
|
pull?: UnderlyingSourcePullCallback<R>;
|
|
141
121
|
start?: UnderlyingSourceStartCallback<R>;
|
|
142
122
|
type?: undefined;
|
|
143
123
|
}
|
|
144
|
-
|
|
145
124
|
interface UnderlyingSink<W = any> {
|
|
146
125
|
abort?: UnderlyingSinkAbortCallback;
|
|
147
126
|
close?: UnderlyingSinkCloseCallback;
|
|
@@ -149,11 +128,9 @@ declare module 'stream/web' {
|
|
|
149
128
|
type?: undefined;
|
|
150
129
|
write?: UnderlyingSinkWriteCallback<W>;
|
|
151
130
|
}
|
|
152
|
-
|
|
153
131
|
interface ReadableStreamErrorCallback {
|
|
154
132
|
(reason: any): void | PromiseLike<void>;
|
|
155
133
|
}
|
|
156
|
-
|
|
157
134
|
/** This Streams API interface represents a readable stream of byte data. */
|
|
158
135
|
interface ReadableStream<R = any> {
|
|
159
136
|
readonly locked: boolean;
|
|
@@ -165,29 +142,21 @@ declare module 'stream/web' {
|
|
|
165
142
|
values(options?: { preventCancel?: boolean }): AsyncIterableIterator<R>;
|
|
166
143
|
[Symbol.asyncIterator](): AsyncIterableIterator<R>;
|
|
167
144
|
}
|
|
168
|
-
|
|
169
145
|
const ReadableStream: {
|
|
170
146
|
prototype: ReadableStream;
|
|
171
|
-
new (
|
|
172
|
-
underlyingSource: UnderlyingByteSource,
|
|
173
|
-
strategy?: QueuingStrategy<Uint8Array>,
|
|
174
|
-
): ReadableStream<Uint8Array>;
|
|
147
|
+
new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
|
|
175
148
|
new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
|
|
176
149
|
};
|
|
177
|
-
|
|
178
150
|
interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
|
|
179
151
|
read(): Promise<ReadableStreamDefaultReadResult<R>>;
|
|
180
152
|
releaseLock(): void;
|
|
181
153
|
}
|
|
182
|
-
|
|
183
154
|
const ReadableStreamDefaultReader: {
|
|
184
155
|
prototype: ReadableStreamDefaultReader;
|
|
185
156
|
new <R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
|
|
186
157
|
};
|
|
187
|
-
|
|
188
158
|
const ReadableStreamBYOBReader: any;
|
|
189
159
|
const ReadableStreamBYOBRequest: any;
|
|
190
|
-
|
|
191
160
|
interface ReadableByteStreamController {
|
|
192
161
|
readonly byobRequest: undefined;
|
|
193
162
|
readonly desiredSize: number | null;
|
|
@@ -195,24 +164,20 @@ declare module 'stream/web' {
|
|
|
195
164
|
enqueue(chunk: ArrayBufferView): void;
|
|
196
165
|
error(error?: any): void;
|
|
197
166
|
}
|
|
198
|
-
|
|
199
167
|
const ReadableByteStreamController: {
|
|
200
168
|
prototype: ReadableByteStreamController;
|
|
201
169
|
new (): ReadableByteStreamController;
|
|
202
170
|
};
|
|
203
|
-
|
|
204
171
|
interface ReadableStreamDefaultController<R = any> {
|
|
205
172
|
readonly desiredSize: number | null;
|
|
206
173
|
close(): void;
|
|
207
174
|
enqueue(chunk?: R): void;
|
|
208
175
|
error(e?: any): void;
|
|
209
176
|
}
|
|
210
|
-
|
|
211
177
|
const ReadableStreamDefaultController: {
|
|
212
178
|
prototype: ReadableStreamDefaultController;
|
|
213
179
|
new (): ReadableStreamDefaultController;
|
|
214
180
|
};
|
|
215
|
-
|
|
216
181
|
interface Transformer<I = any, O = any> {
|
|
217
182
|
flush?: TransformerFlushCallback<O>;
|
|
218
183
|
readableType?: undefined;
|
|
@@ -220,33 +185,24 @@ declare module 'stream/web' {
|
|
|
220
185
|
transform?: TransformerTransformCallback<I, O>;
|
|
221
186
|
writableType?: undefined;
|
|
222
187
|
}
|
|
223
|
-
|
|
224
188
|
interface TransformStream<I = any, O = any> {
|
|
225
189
|
readonly readable: ReadableStream<O>;
|
|
226
190
|
readonly writable: WritableStream<I>;
|
|
227
191
|
}
|
|
228
|
-
|
|
229
192
|
const TransformStream: {
|
|
230
193
|
prototype: TransformStream;
|
|
231
|
-
new <I = any, O = any>(
|
|
232
|
-
transformer?: Transformer<I, O>,
|
|
233
|
-
writableStrategy?: QueuingStrategy<I>,
|
|
234
|
-
readableStrategy?: QueuingStrategy<O>,
|
|
235
|
-
): TransformStream<I, O>;
|
|
194
|
+
new <I = any, O = any>(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>): TransformStream<I, O>;
|
|
236
195
|
};
|
|
237
|
-
|
|
238
196
|
interface TransformStreamDefaultController<O = any> {
|
|
239
197
|
readonly desiredSize: number | null;
|
|
240
198
|
enqueue(chunk?: O): void;
|
|
241
199
|
error(reason?: any): void;
|
|
242
200
|
terminate(): void;
|
|
243
201
|
}
|
|
244
|
-
|
|
245
202
|
const TransformStreamDefaultController: {
|
|
246
203
|
prototype: TransformStreamDefaultController;
|
|
247
204
|
new (): TransformStreamDefaultController;
|
|
248
205
|
};
|
|
249
|
-
|
|
250
206
|
/**
|
|
251
207
|
* This Streams API interface provides a standard abstraction for writing
|
|
252
208
|
* streaming data to a destination, known as a sink. This object comes with
|
|
@@ -258,12 +214,10 @@ declare module 'stream/web' {
|
|
|
258
214
|
close(): Promise<void>;
|
|
259
215
|
getWriter(): WritableStreamDefaultWriter<W>;
|
|
260
216
|
}
|
|
261
|
-
|
|
262
217
|
const WritableStream: {
|
|
263
218
|
prototype: WritableStream;
|
|
264
219
|
new <W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
|
|
265
220
|
};
|
|
266
|
-
|
|
267
221
|
/**
|
|
268
222
|
* This Streams API interface is the object returned by
|
|
269
223
|
* WritableStream.getWriter() and once created locks the < writer to the
|
|
@@ -279,12 +233,10 @@ declare module 'stream/web' {
|
|
|
279
233
|
releaseLock(): void;
|
|
280
234
|
write(chunk?: W): Promise<void>;
|
|
281
235
|
}
|
|
282
|
-
|
|
283
236
|
const WritableStreamDefaultWriter: {
|
|
284
237
|
prototype: WritableStreamDefaultWriter;
|
|
285
238
|
new <W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
|
|
286
239
|
};
|
|
287
|
-
|
|
288
240
|
/**
|
|
289
241
|
* This Streams API interface represents a controller allowing control of a
|
|
290
242
|
* WritableStream's state. When constructing a WritableStream, the
|
|
@@ -294,21 +246,17 @@ declare module 'stream/web' {
|
|
|
294
246
|
interface WritableStreamDefaultController {
|
|
295
247
|
error(e?: any): void;
|
|
296
248
|
}
|
|
297
|
-
|
|
298
249
|
const WritableStreamDefaultController: {
|
|
299
250
|
prototype: WritableStreamDefaultController;
|
|
300
251
|
new (): WritableStreamDefaultController;
|
|
301
252
|
};
|
|
302
|
-
|
|
303
253
|
interface QueuingStrategy<T = any> {
|
|
304
254
|
highWaterMark?: number;
|
|
305
255
|
size?: QueuingStrategySize<T>;
|
|
306
256
|
}
|
|
307
|
-
|
|
308
257
|
interface QueuingStrategySize<T = any> {
|
|
309
258
|
(chunk?: T): number;
|
|
310
259
|
}
|
|
311
|
-
|
|
312
260
|
interface QueuingStrategyInit {
|
|
313
261
|
/**
|
|
314
262
|
* Creates a new ByteLengthQueuingStrategy with the provided high water
|
|
@@ -321,7 +269,6 @@ declare module 'stream/web' {
|
|
|
321
269
|
*/
|
|
322
270
|
highWaterMark: number;
|
|
323
271
|
}
|
|
324
|
-
|
|
325
272
|
/**
|
|
326
273
|
* This Streams API interface provides a built-in byte length queuing
|
|
327
274
|
* strategy that can be used when constructing streams.
|
|
@@ -330,12 +277,10 @@ declare module 'stream/web' {
|
|
|
330
277
|
readonly highWaterMark: number;
|
|
331
278
|
readonly size: QueuingStrategySize<ArrayBufferView>;
|
|
332
279
|
}
|
|
333
|
-
|
|
334
280
|
const ByteLengthQueuingStrategy: {
|
|
335
281
|
prototype: ByteLengthQueuingStrategy;
|
|
336
282
|
new (init: QueuingStrategyInit): ByteLengthQueuingStrategy;
|
|
337
283
|
};
|
|
338
|
-
|
|
339
284
|
/**
|
|
340
285
|
* This Streams API interface provides a built-in byte length queuing
|
|
341
286
|
* strategy that can be used when constructing streams.
|
|
@@ -344,12 +289,10 @@ declare module 'stream/web' {
|
|
|
344
289
|
readonly highWaterMark: number;
|
|
345
290
|
readonly size: QueuingStrategySize;
|
|
346
291
|
}
|
|
347
|
-
|
|
348
292
|
const CountQueuingStrategy: {
|
|
349
293
|
prototype: CountQueuingStrategy;
|
|
350
294
|
new (init: QueuingStrategyInit): CountQueuingStrategy;
|
|
351
295
|
};
|
|
352
|
-
|
|
353
296
|
interface TextEncoderStream {
|
|
354
297
|
/** Returns "utf-8". */
|
|
355
298
|
readonly encoding: 'utf-8';
|
|
@@ -357,19 +300,15 @@ declare module 'stream/web' {
|
|
|
357
300
|
readonly writable: WritableStream<string>;
|
|
358
301
|
readonly [Symbol.toStringTag]: string;
|
|
359
302
|
}
|
|
360
|
-
|
|
361
303
|
const TextEncoderStream: {
|
|
362
304
|
prototype: TextEncoderStream;
|
|
363
305
|
new (): TextEncoderStream;
|
|
364
306
|
};
|
|
365
|
-
|
|
366
307
|
interface TextDecoderOptions {
|
|
367
308
|
fatal?: boolean;
|
|
368
309
|
ignoreBOM?: boolean;
|
|
369
310
|
}
|
|
370
|
-
|
|
371
311
|
type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
372
|
-
|
|
373
312
|
interface TextDecoderStream {
|
|
374
313
|
/** Returns encoding's name, lower cased. */
|
|
375
314
|
readonly encoding: string;
|
|
@@ -381,7 +320,6 @@ declare module 'stream/web' {
|
|
|
381
320
|
readonly writable: WritableStream<BufferSource>;
|
|
382
321
|
readonly [Symbol.toStringTag]: string;
|
|
383
322
|
}
|
|
384
|
-
|
|
385
323
|
const TextDecoderStream: {
|
|
386
324
|
prototype: TextDecoderStream;
|
|
387
325
|
new (label?: string, options?: TextDecoderOptions): TextDecoderStream;
|