@types/node 16.9.5 → 16.10.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/README.md +2 -2
- node/buffer.d.ts +1 -1
- node/crypto.d.ts +51 -3
- node/fs/promises.d.ts +2 -2
- node/fs.d.ts +37 -20
- node/http.d.ts +13 -3
- node/index.d.ts +1 -2
- node/package.json +2 -7
- node/stream.d.ts +26 -6
- node/tty.d.ts +1 -3
node/README.md
CHANGED
|
@@ -8,9 +8,9 @@ This package contains type definitions for Node.js (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Wed, 29 Sep 2021 14:01:20 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
|
|
14
14
|
|
|
15
15
|
# Credits
|
|
16
|
-
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [
|
|
16
|
+
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), and [wafuwafu13](https://github.com/wafuwafu13).
|
node/buffer.d.ts
CHANGED
|
@@ -176,7 +176,7 @@ declare module 'buffer' {
|
|
|
176
176
|
/**
|
|
177
177
|
* Raw data is stored in instances of the Buffer class.
|
|
178
178
|
* A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
|
|
179
|
-
* Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
|
179
|
+
* Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex'
|
|
180
180
|
*/
|
|
181
181
|
interface BufferConstructor {
|
|
182
182
|
/**
|
node/crypto.d.ts
CHANGED
|
@@ -250,7 +250,7 @@ declare module 'crypto' {
|
|
|
250
250
|
*/
|
|
251
251
|
function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
|
|
252
252
|
// https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
|
|
253
|
-
type BinaryToTextEncoding = 'base64' | 'hex';
|
|
253
|
+
type BinaryToTextEncoding = 'base64' | 'base64url' | 'hex';
|
|
254
254
|
type CharacterEncoding = 'utf8' | 'utf-8' | 'utf16le' | 'latin1';
|
|
255
255
|
type LegacyCharacterEncoding = 'ascii' | 'binary' | 'ucs2' | 'ucs-2';
|
|
256
256
|
type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding;
|
|
@@ -1167,6 +1167,26 @@ declare module 'crypto' {
|
|
|
1167
1167
|
},
|
|
1168
1168
|
callback: (err: Error | null, key: KeyObject) => void
|
|
1169
1169
|
): void;
|
|
1170
|
+
/**
|
|
1171
|
+
* Synchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
|
|
1172
|
+
*
|
|
1173
|
+
* ```js
|
|
1174
|
+
* const {
|
|
1175
|
+
* generateKeySync
|
|
1176
|
+
* } = await import('crypto');
|
|
1177
|
+
*
|
|
1178
|
+
* const key = generateKeySync('hmac', 64);
|
|
1179
|
+
* console.log(key.export().toString('hex')); // e89..........41e
|
|
1180
|
+
* ```
|
|
1181
|
+
* @since v15.0.0
|
|
1182
|
+
* @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
|
|
1183
|
+
*/
|
|
1184
|
+
function generateKeySync(
|
|
1185
|
+
type: 'hmac' | 'aes',
|
|
1186
|
+
options: {
|
|
1187
|
+
length: number;
|
|
1188
|
+
}
|
|
1189
|
+
): KeyObject;
|
|
1170
1190
|
interface JsonWebKeyInput {
|
|
1171
1191
|
key: JsonWebKey;
|
|
1172
1192
|
format: 'jwk';
|
|
@@ -2140,7 +2160,7 @@ declare module 'crypto' {
|
|
|
2140
2160
|
key: BinaryLike,
|
|
2141
2161
|
curve: string,
|
|
2142
2162
|
inputEncoding?: BinaryToTextEncoding,
|
|
2143
|
-
outputEncoding?: 'latin1' | 'hex' | 'base64',
|
|
2163
|
+
outputEncoding?: 'latin1' | 'hex' | 'base64' | 'base64url',
|
|
2144
2164
|
format?: 'uncompressed' | 'compressed' | 'hybrid'
|
|
2145
2165
|
): Buffer | string;
|
|
2146
2166
|
/**
|
|
@@ -2259,7 +2279,7 @@ declare module 'crypto' {
|
|
|
2259
2279
|
interface X448KeyPairKeyObjectOptions {}
|
|
2260
2280
|
interface ECKeyPairKeyObjectOptions {
|
|
2261
2281
|
/**
|
|
2262
|
-
* Name of the curve to use
|
|
2282
|
+
* Name of the curve to use
|
|
2263
2283
|
*/
|
|
2264
2284
|
namedCurve: string;
|
|
2265
2285
|
}
|
|
@@ -2269,6 +2289,7 @@ declare module 'crypto' {
|
|
|
2269
2289
|
*/
|
|
2270
2290
|
modulusLength: number;
|
|
2271
2291
|
/**
|
|
2292
|
+
* Public exponent
|
|
2272
2293
|
* @default 0x10001
|
|
2273
2294
|
*/
|
|
2274
2295
|
publicExponent?: number | undefined;
|
|
@@ -2279,9 +2300,22 @@ declare module 'crypto' {
|
|
|
2279
2300
|
*/
|
|
2280
2301
|
modulusLength: number;
|
|
2281
2302
|
/**
|
|
2303
|
+
* Public exponent
|
|
2282
2304
|
* @default 0x10001
|
|
2283
2305
|
*/
|
|
2284
2306
|
publicExponent?: number | undefined;
|
|
2307
|
+
/**
|
|
2308
|
+
* Name of the message digest
|
|
2309
|
+
*/
|
|
2310
|
+
hashAlgorithm?: string;
|
|
2311
|
+
/**
|
|
2312
|
+
* Name of the message digest used by MGF1
|
|
2313
|
+
*/
|
|
2314
|
+
mgf1HashAlgorithm?: string;
|
|
2315
|
+
/**
|
|
2316
|
+
* Minimal salt length in bytes
|
|
2317
|
+
*/
|
|
2318
|
+
saltLength?: string;
|
|
2285
2319
|
}
|
|
2286
2320
|
interface DSAKeyPairKeyObjectOptions {
|
|
2287
2321
|
/**
|
|
@@ -2299,6 +2333,7 @@ declare module 'crypto' {
|
|
|
2299
2333
|
*/
|
|
2300
2334
|
modulusLength: number;
|
|
2301
2335
|
/**
|
|
2336
|
+
* Public exponent
|
|
2302
2337
|
* @default 0x10001
|
|
2303
2338
|
*/
|
|
2304
2339
|
publicExponent?: number | undefined;
|
|
@@ -2316,9 +2351,22 @@ declare module 'crypto' {
|
|
|
2316
2351
|
*/
|
|
2317
2352
|
modulusLength: number;
|
|
2318
2353
|
/**
|
|
2354
|
+
* Public exponent
|
|
2319
2355
|
* @default 0x10001
|
|
2320
2356
|
*/
|
|
2321
2357
|
publicExponent?: number | undefined;
|
|
2358
|
+
/**
|
|
2359
|
+
* Name of the message digest
|
|
2360
|
+
*/
|
|
2361
|
+
hashAlgorithm?: string;
|
|
2362
|
+
/**
|
|
2363
|
+
* Name of the message digest used by MGF1
|
|
2364
|
+
*/
|
|
2365
|
+
mgf1HashAlgorithm?: string;
|
|
2366
|
+
/**
|
|
2367
|
+
* Minimal salt length in bytes
|
|
2368
|
+
*/
|
|
2369
|
+
saltLength?: string;
|
|
2322
2370
|
publicKeyEncoding: {
|
|
2323
2371
|
type: 'spki';
|
|
2324
2372
|
format: PubF;
|
node/fs/promises.d.ts
CHANGED
|
@@ -114,8 +114,8 @@ declare module 'fs/promises' {
|
|
|
114
114
|
* number of bytes read is zero.
|
|
115
115
|
* @since v10.0.0
|
|
116
116
|
* @param buffer A buffer that will be filled with the file data read.
|
|
117
|
-
* @param
|
|
118
|
-
* @param
|
|
117
|
+
* @param offset The location in the buffer at which to start filling.
|
|
118
|
+
* @param length The number of bytes to read.
|
|
119
119
|
* @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an
|
|
120
120
|
* integer, the current file position will remain unchanged.
|
|
121
121
|
* @return Fulfills upon success with an object with two properties:
|
node/fs.d.ts
CHANGED
|
@@ -904,42 +904,42 @@ declare module 'fs' {
|
|
|
904
904
|
): Promise<BigIntStats>;
|
|
905
905
|
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
906
906
|
}
|
|
907
|
-
export interface StatSyncFn
|
|
908
|
-
(path:
|
|
907
|
+
export interface StatSyncFn extends Function {
|
|
908
|
+
(path: PathLike, options?: undefined): Stats;
|
|
909
909
|
(
|
|
910
|
-
path:
|
|
911
|
-
options?:
|
|
910
|
+
path: PathLike,
|
|
911
|
+
options?: StatSyncOptions & {
|
|
912
912
|
bigint?: false | undefined;
|
|
913
913
|
throwIfNoEntry: false;
|
|
914
914
|
}
|
|
915
915
|
): Stats | undefined;
|
|
916
916
|
(
|
|
917
|
-
path:
|
|
918
|
-
options:
|
|
917
|
+
path: PathLike,
|
|
918
|
+
options: StatSyncOptions & {
|
|
919
919
|
bigint: true;
|
|
920
920
|
throwIfNoEntry: false;
|
|
921
921
|
}
|
|
922
922
|
): BigIntStats | undefined;
|
|
923
923
|
(
|
|
924
|
-
path:
|
|
925
|
-
options?:
|
|
924
|
+
path: PathLike,
|
|
925
|
+
options?: StatSyncOptions & {
|
|
926
926
|
bigint?: false | undefined;
|
|
927
927
|
}
|
|
928
928
|
): Stats;
|
|
929
929
|
(
|
|
930
|
-
path:
|
|
931
|
-
options:
|
|
930
|
+
path: PathLike,
|
|
931
|
+
options: StatSyncOptions & {
|
|
932
932
|
bigint: true;
|
|
933
933
|
}
|
|
934
934
|
): BigIntStats;
|
|
935
935
|
(
|
|
936
|
-
path:
|
|
937
|
-
options:
|
|
936
|
+
path: PathLike,
|
|
937
|
+
options: StatSyncOptions & {
|
|
938
938
|
bigint: boolean;
|
|
939
939
|
throwIfNoEntry?: false | undefined;
|
|
940
940
|
}
|
|
941
941
|
): Stats | BigIntStats;
|
|
942
|
-
(path:
|
|
942
|
+
(path: PathLike, options?: StatSyncOptions): Stats | BigIntStats | undefined;
|
|
943
943
|
}
|
|
944
944
|
/**
|
|
945
945
|
* Synchronous stat(2) - Get file status.
|
|
@@ -993,7 +993,20 @@ declare module 'fs' {
|
|
|
993
993
|
* Synchronous fstat(2) - Get file status.
|
|
994
994
|
* @param fd A file descriptor.
|
|
995
995
|
*/
|
|
996
|
-
export
|
|
996
|
+
export function fstatSync(
|
|
997
|
+
fd: number,
|
|
998
|
+
options?: StatOptions & {
|
|
999
|
+
bigint?: false | undefined;
|
|
1000
|
+
}
|
|
1001
|
+
): Stats;
|
|
1002
|
+
export function fstatSync(
|
|
1003
|
+
fd: number,
|
|
1004
|
+
options: StatOptions & {
|
|
1005
|
+
bigint: true;
|
|
1006
|
+
}
|
|
1007
|
+
): BigIntStats;
|
|
1008
|
+
export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
|
|
1009
|
+
|
|
997
1010
|
/**
|
|
998
1011
|
* Retrieves the `fs.Stats` for the symbolic link referred to by the path.
|
|
999
1012
|
* The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic
|
|
@@ -1456,7 +1469,7 @@ declare module 'fs' {
|
|
|
1456
1469
|
* Asynchronously creates a directory.
|
|
1457
1470
|
*
|
|
1458
1471
|
* The callback is given a possible exception and, if `recursive` is `true`, the
|
|
1459
|
-
* first directory path created, `(err,
|
|
1472
|
+
* first directory path created, `(err[, path])`.`path` can still be `undefined` when `recursive` is `true`, if no directory was
|
|
1460
1473
|
* created.
|
|
1461
1474
|
*
|
|
1462
1475
|
* The optional `options` argument can be an integer specifying `mode` (permission
|
|
@@ -2202,9 +2215,9 @@ declare module 'fs' {
|
|
|
2202
2215
|
* If this method is invoked as its `util.promisify()` ed version, it returns
|
|
2203
2216
|
* a promise for an `Object` with `bytesRead` and `buffer` properties.
|
|
2204
2217
|
* @since v0.0.2
|
|
2205
|
-
* @param
|
|
2206
|
-
* @param
|
|
2207
|
-
* @param
|
|
2218
|
+
* @param buffer The buffer that the data will be written to.
|
|
2219
|
+
* @param offset The position in `buffer` to write the data to.
|
|
2220
|
+
* @param length The number of bytes to read.
|
|
2208
2221
|
* @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If
|
|
2209
2222
|
* `position` is an integer, the file position will be unchanged.
|
|
2210
2223
|
*/
|
|
@@ -3370,7 +3383,8 @@ declare module 'fs' {
|
|
|
3370
3383
|
* destroyed, like most `Readable` streams. Set the `emitClose` option to`false` to change this behavior.
|
|
3371
3384
|
*
|
|
3372
3385
|
* By providing the `fs` option, it is possible to override the corresponding `fs`implementations for `open`, `read`, and `close`. When providing the `fs` option,
|
|
3373
|
-
*
|
|
3386
|
+
* an override for `read` is required. If no `fd` is provided, an override for`open` is also required. If `autoClose` is `true`, an override for `close` is
|
|
3387
|
+
* also required.
|
|
3374
3388
|
*
|
|
3375
3389
|
* ```js
|
|
3376
3390
|
* import { createReadStream } from 'fs';
|
|
@@ -3428,7 +3442,8 @@ declare module 'fs' {
|
|
|
3428
3442
|
*
|
|
3429
3443
|
* By providing the `fs` option it is possible to override the corresponding `fs`implementations for `open`, `write`, `writev` and `close`. Overriding `write()`without `writev()` can reduce
|
|
3430
3444
|
* performance as some optimizations (`_writev()`)
|
|
3431
|
-
* will be disabled. When providing the `fs` option,
|
|
3445
|
+
* will be disabled. When providing the `fs` option, overrides for at least one of`write` and `writev` are required. If no `fd` option is supplied, an override
|
|
3446
|
+
* for `open` is also required. If `autoClose` is `true`, an override for `close`is also required.
|
|
3432
3447
|
*
|
|
3433
3448
|
* Like `fs.ReadStream`, if `fd` is specified, `fs.WriteStream` will ignore the`path` argument and will use the specified file descriptor. This means that no`'open'` event will be
|
|
3434
3449
|
* emitted. `fd` should be blocking; non-blocking `fd`s
|
|
@@ -3662,6 +3677,8 @@ declare module 'fs' {
|
|
|
3662
3677
|
}
|
|
3663
3678
|
export interface StatOptions {
|
|
3664
3679
|
bigint?: boolean | undefined;
|
|
3680
|
+
}
|
|
3681
|
+
export interface StatSyncOptions extends StatOptions {
|
|
3665
3682
|
throwIfNoEntry?: boolean | undefined;
|
|
3666
3683
|
}
|
|
3667
3684
|
export interface CopyOptions {
|
node/http.d.ts
CHANGED
|
@@ -183,6 +183,18 @@ declare module 'http' {
|
|
|
183
183
|
* @since v0.7.0
|
|
184
184
|
*/
|
|
185
185
|
maxHeadersCount: number | null;
|
|
186
|
+
/**
|
|
187
|
+
* The maximum number of requests socket can handle
|
|
188
|
+
* before closing keep alive connection.
|
|
189
|
+
*
|
|
190
|
+
* A value of `null` will disable the limit.
|
|
191
|
+
*
|
|
192
|
+
* When limit is reach it will set `Connection` header value to `closed`,
|
|
193
|
+
* but will not actually close the connection, subsequent requests sent
|
|
194
|
+
* after the limit is reached will get `503 Service Unavailable` as a response.
|
|
195
|
+
* @since v16.10.0
|
|
196
|
+
*/
|
|
197
|
+
maxRequestsPerSocket: number | null;
|
|
186
198
|
/**
|
|
187
199
|
* The number of milliseconds of inactivity before a socket is presumed
|
|
188
200
|
* to have timed out.
|
|
@@ -341,11 +353,9 @@ declare module 'http' {
|
|
|
341
353
|
readonly socket: Socket | null;
|
|
342
354
|
constructor();
|
|
343
355
|
/**
|
|
344
|
-
* occurs, Same as binding to the `timeout` event.
|
|
345
|
-
*
|
|
346
356
|
* Once a socket is associated with the message and is connected,`socket.setTimeout()` will be called with `msecs` as the first parameter.
|
|
347
357
|
* @since v0.9.12
|
|
348
|
-
* @param callback Optional function to be called when a timeout
|
|
358
|
+
* @param callback Optional function to be called when a timeout occurs. Same as binding to the `timeout` event.
|
|
349
359
|
*/
|
|
350
360
|
setTimeout(msecs: number, callback?: () => void): this;
|
|
351
361
|
/**
|
node/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for non-npm package Node.js 16.
|
|
1
|
+
// Type definitions for non-npm package Node.js 16.10
|
|
2
2
|
// Project: https://nodejs.org/
|
|
3
3
|
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
|
4
4
|
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
// Surasak Chaisurin <https://github.com/Ryan-Willpower>
|
|
38
38
|
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
|
39
39
|
// Anna Henningsen <https://github.com/addaleax>
|
|
40
|
-
// Jason Kwok <https://github.com/JasonHK>
|
|
41
40
|
// Victor Perin <https://github.com/victorperin>
|
|
42
41
|
// Yongsheng Zhang <https://github.com/ZYSzys>
|
|
43
42
|
// NodeJS Contributors <https://github.com/NodeJS>
|
node/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.10.2",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -190,11 +190,6 @@
|
|
|
190
190
|
"url": "https://github.com/addaleax",
|
|
191
191
|
"githubUsername": "addaleax"
|
|
192
192
|
},
|
|
193
|
-
{
|
|
194
|
-
"name": "Jason Kwok",
|
|
195
|
-
"url": "https://github.com/JasonHK",
|
|
196
|
-
"githubUsername": "JasonHK"
|
|
197
|
-
},
|
|
198
193
|
{
|
|
199
194
|
"name": "Victor Perin",
|
|
200
195
|
"url": "https://github.com/victorperin",
|
|
@@ -230,6 +225,6 @@
|
|
|
230
225
|
},
|
|
231
226
|
"scripts": {},
|
|
232
227
|
"dependencies": {},
|
|
233
|
-
"typesPublisherContentHash": "
|
|
228
|
+
"typesPublisherContentHash": "6023f3e7c950e00a7318d296af3923465c485d15acf5808695a572b526215e74",
|
|
234
229
|
"typeScriptVersion": "3.7"
|
|
235
230
|
}
|
node/stream.d.ts
CHANGED
|
@@ -1083,16 +1083,14 @@ declare module 'stream' {
|
|
|
1083
1083
|
*
|
|
1084
1084
|
* async function run() {
|
|
1085
1085
|
* const ac = new AbortController();
|
|
1086
|
-
* const
|
|
1087
|
-
* signal: ac.signal,
|
|
1088
|
-
* };
|
|
1086
|
+
* const signal = ac.signal;
|
|
1089
1087
|
*
|
|
1090
1088
|
* setTimeout(() => ac.abort(), 1);
|
|
1091
1089
|
* await pipeline(
|
|
1092
1090
|
* fs.createReadStream('archive.tar'),
|
|
1093
1091
|
* zlib.createGzip(),
|
|
1094
1092
|
* fs.createWriteStream('archive.tar.gz'),
|
|
1095
|
-
*
|
|
1093
|
+
* { signal },
|
|
1096
1094
|
* );
|
|
1097
1095
|
* }
|
|
1098
1096
|
*
|
|
@@ -1108,10 +1106,10 @@ declare module 'stream' {
|
|
|
1108
1106
|
* async function run() {
|
|
1109
1107
|
* await pipeline(
|
|
1110
1108
|
* fs.createReadStream('lowercase.txt'),
|
|
1111
|
-
* async function* (source) {
|
|
1109
|
+
* async function* (source, signal) {
|
|
1112
1110
|
* source.setEncoding('utf8'); // Work with strings rather than `Buffer`s.
|
|
1113
1111
|
* for await (const chunk of source) {
|
|
1114
|
-
* yield chunk
|
|
1112
|
+
* yield await processChunk(chunk, { signal });
|
|
1115
1113
|
* }
|
|
1116
1114
|
* },
|
|
1117
1115
|
* fs.createWriteStream('uppercase.txt')
|
|
@@ -1122,6 +1120,28 @@ declare module 'stream' {
|
|
|
1122
1120
|
* run().catch(console.error);
|
|
1123
1121
|
* ```
|
|
1124
1122
|
*
|
|
1123
|
+
* Remember to handle the `signal` argument passed into the async generator.
|
|
1124
|
+
* Especially in the case where the async generator is the source for the
|
|
1125
|
+
* pipeline (i.e. first argument) or the pipeline will never complete.
|
|
1126
|
+
*
|
|
1127
|
+
* ```js
|
|
1128
|
+
* const { pipeline } = require('stream/promises');
|
|
1129
|
+
* const fs = require('fs');
|
|
1130
|
+
*
|
|
1131
|
+
* async function run() {
|
|
1132
|
+
* await pipeline(
|
|
1133
|
+
* async function * (signal) {
|
|
1134
|
+
* await someLongRunningfn({ signal });
|
|
1135
|
+
* yield 'asd';
|
|
1136
|
+
* },
|
|
1137
|
+
* fs.createWriteStream('uppercase.txt')
|
|
1138
|
+
* );
|
|
1139
|
+
* console.log('Pipeline succeeded.');
|
|
1140
|
+
* }
|
|
1141
|
+
*
|
|
1142
|
+
* run().catch(console.error);
|
|
1143
|
+
* ```
|
|
1144
|
+
*
|
|
1125
1145
|
* `stream.pipeline()` will call `stream.destroy(err)` on all streams except:
|
|
1126
1146
|
*
|
|
1127
1147
|
* * `Readable` streams which have emitted `'end'` or `'close'`.
|
node/tty.d.ts
CHANGED
|
@@ -129,9 +129,7 @@ declare module 'tty' {
|
|
|
129
129
|
* * `1` for 2,
|
|
130
130
|
* * `4` for 16,
|
|
131
131
|
* * `8` for 256,
|
|
132
|
-
* * `24` for 16,777,216
|
|
133
|
-
*
|
|
134
|
-
* colors supported.
|
|
132
|
+
* * `24` for 16,777,216 colors supported.
|
|
135
133
|
*
|
|
136
134
|
* Use this to determine what colors the terminal supports. Due to the nature of
|
|
137
135
|
* colors in terminals it is possible to either have false positives or false
|