@types/node 16.6.1 → 16.7.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 +1 -1
- node/assert.d.ts +1 -1
- node/async_hooks.d.ts +1 -1
- node/buffer.d.ts +256 -37
- node/child_process.d.ts +2 -2
- node/cluster.d.ts +1 -1
- node/console.d.ts +1 -1
- node/crypto.d.ts +9 -9
- node/dgram.d.ts +1 -1
- node/diagnostics_channel.d.ts +1 -1
- node/dns.d.ts +5 -1
- node/domain.d.ts +1 -1
- node/events.d.ts +183 -4
- node/fs/promises.d.ts +33 -19
- node/fs.d.ts +118 -48
- node/http.d.ts +5 -5
- node/http2.d.ts +1 -1
- node/https.d.ts +1 -1
- node/index.d.ts +58 -11
- node/inspector.d.ts +1 -1
- node/net.d.ts +2 -2
- node/os.d.ts +1 -1
- node/package.json +3 -10
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +3 -3
- node/process.d.ts +2 -1
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +2 -2
- node/readline.d.ts +1 -1
- node/repl.d.ts +1 -1
- node/stream/web.d.ts +0 -1
- node/stream.d.ts +2 -2
- node/string_decoder.d.ts +1 -1
- node/timers.d.ts +1 -1
- node/tls.d.ts +3 -3
- node/trace_events.d.ts +1 -1
- node/tty.d.ts +1 -1
- node/url.d.ts +37 -2
- node/util.d.ts +3 -3
- node/v8.d.ts +1 -1
- node/vm.d.ts +1 -1
- node/wasi.d.ts +1 -1
- node/worker_threads.d.ts +1 -1
- node/zlib.d.ts +1 -1
- node/base.d.ts +0 -19
- node/ts3.6/assert.d.ts +0 -103
- node/ts3.6/base.d.ts +0 -68
- node/ts3.6/index.d.ts +0 -7
node/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://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: Thu,
|
|
11
|
+
* Last updated: Thu, 26 Aug 2021 01:01:28 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
|
|
14
14
|
|
node/assert.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `assert` module provides a set of assertion functions for verifying
|
|
3
3
|
* invariants.
|
|
4
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
4
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/assert.js)
|
|
5
5
|
*/
|
|
6
6
|
declare module 'assert' {
|
|
7
7
|
/**
|
node/async_hooks.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* import async_hooks from 'async_hooks';
|
|
7
7
|
* ```
|
|
8
8
|
* @experimental
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/async_hooks.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'async_hooks' {
|
|
12
12
|
/**
|
node/buffer.d.ts
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
|
|
42
42
|
* const buf7 = Buffer.from('tést', 'latin1');
|
|
43
43
|
* ```
|
|
44
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
44
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/buffer.js)
|
|
45
45
|
*/
|
|
46
46
|
declare module 'buffer' {
|
|
47
47
|
import { BinaryLike } from 'node:crypto';
|
|
@@ -86,6 +86,14 @@ declare module 'buffer' {
|
|
|
86
86
|
new (size: number): Buffer;
|
|
87
87
|
prototype: Buffer;
|
|
88
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
|
|
91
|
+
* a prior call to `URL.createObjectURL()`.
|
|
92
|
+
* @since v16.7.0
|
|
93
|
+
* @experimental
|
|
94
|
+
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
|
95
|
+
*/
|
|
96
|
+
export function resolveObjectURL(id: string): Blob | undefined;
|
|
89
97
|
export { Buffer };
|
|
90
98
|
/**
|
|
91
99
|
* @experimental
|
|
@@ -144,11 +152,16 @@ declare module 'buffer' {
|
|
|
144
152
|
*/
|
|
145
153
|
slice(start?: number, end?: number, type?: string): Blob;
|
|
146
154
|
/**
|
|
147
|
-
* Returns a promise that
|
|
148
|
-
* string.
|
|
155
|
+
* Returns a promise that fulfills with the contents of the `Blob` decoded as a
|
|
156
|
+
* UTF-8 string.
|
|
149
157
|
* @since v15.7.0
|
|
150
158
|
*/
|
|
151
159
|
text(): Promise<string>;
|
|
160
|
+
/**
|
|
161
|
+
* Returns a new `ReadableStream` that allows the content of the `Blob` to be read.
|
|
162
|
+
* @since v16.7.0
|
|
163
|
+
*/
|
|
164
|
+
stream(): unknown; // pending web streams types
|
|
152
165
|
}
|
|
153
166
|
export import atob = globalThis.atob;
|
|
154
167
|
export import btoa = globalThis.btoa;
|
|
@@ -212,12 +225,21 @@ declare module 'buffer' {
|
|
|
212
225
|
*/
|
|
213
226
|
new (buffer: Buffer): Buffer;
|
|
214
227
|
/**
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
228
|
+
* Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
|
|
229
|
+
* Array entries outside that range will be truncated to fit into it.
|
|
230
|
+
*
|
|
231
|
+
* ```js
|
|
232
|
+
* import { Buffer } from 'buffer';
|
|
233
|
+
*
|
|
234
|
+
* // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
|
|
235
|
+
* const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
|
|
236
|
+
* ```
|
|
237
|
+
*
|
|
238
|
+
* A `TypeError` will be thrown if `array` is not an `Array` or another type
|
|
239
|
+
* appropriate for `Buffer.from()` variants.
|
|
219
240
|
*
|
|
220
|
-
*
|
|
241
|
+
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does.
|
|
242
|
+
* @since v5.10.0
|
|
221
243
|
*/
|
|
222
244
|
from(arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>, byteOffset?: number, length?: number): Buffer;
|
|
223
245
|
/**
|
|
@@ -245,67 +267,264 @@ declare module 'buffer' {
|
|
|
245
267
|
*/
|
|
246
268
|
of(...items: number[]): Buffer;
|
|
247
269
|
/**
|
|
248
|
-
* Returns true if
|
|
270
|
+
* Returns `true` if `obj` is a `Buffer`, `false` otherwise.
|
|
249
271
|
*
|
|
250
|
-
*
|
|
272
|
+
* ```js
|
|
273
|
+
* import { Buffer } from 'buffer';
|
|
274
|
+
*
|
|
275
|
+
* Buffer.isBuffer(Buffer.alloc(10)); // true
|
|
276
|
+
* Buffer.isBuffer(Buffer.from('foo')); // true
|
|
277
|
+
* Buffer.isBuffer('a string'); // false
|
|
278
|
+
* Buffer.isBuffer([]); // false
|
|
279
|
+
* Buffer.isBuffer(new Uint8Array(1024)); // false
|
|
280
|
+
* ```
|
|
281
|
+
* @since v0.1.101
|
|
251
282
|
*/
|
|
252
283
|
isBuffer(obj: any): obj is Buffer;
|
|
253
284
|
/**
|
|
254
|
-
* Returns true if
|
|
255
|
-
*
|
|
285
|
+
* Returns `true` if `encoding` is the name of a supported character encoding,
|
|
286
|
+
* or `false` otherwise.
|
|
287
|
+
*
|
|
288
|
+
* ```js
|
|
289
|
+
* import { Buffer } from 'buffer';
|
|
290
|
+
*
|
|
291
|
+
* console.log(Buffer.isEncoding('utf8'));
|
|
292
|
+
* // Prints: true
|
|
256
293
|
*
|
|
257
|
-
*
|
|
294
|
+
* console.log(Buffer.isEncoding('hex'));
|
|
295
|
+
* // Prints: true
|
|
296
|
+
*
|
|
297
|
+
* console.log(Buffer.isEncoding('utf/8'));
|
|
298
|
+
* // Prints: false
|
|
299
|
+
*
|
|
300
|
+
* console.log(Buffer.isEncoding(''));
|
|
301
|
+
* // Prints: false
|
|
302
|
+
* ```
|
|
303
|
+
* @since v0.9.1
|
|
304
|
+
* @param encoding A character encoding name to check.
|
|
258
305
|
*/
|
|
259
306
|
isEncoding(encoding: string): encoding is BufferEncoding;
|
|
260
307
|
/**
|
|
261
|
-
*
|
|
262
|
-
* This is not the same as String.prototype.length
|
|
308
|
+
* Returns the byte length of a string when encoded using `encoding`.
|
|
309
|
+
* This is not the same as [`String.prototype.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), which does not account
|
|
310
|
+
* for the encoding that is used to convert the string into bytes.
|
|
263
311
|
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
312
|
+
* For `'base64'`, `'base64url'`, and `'hex'`, this function assumes valid input.
|
|
313
|
+
* For strings that contain non-base64/hex-encoded data (e.g. whitespace), the
|
|
314
|
+
* return value might be greater than the length of a `Buffer` created from the
|
|
315
|
+
* string.
|
|
316
|
+
*
|
|
317
|
+
* ```js
|
|
318
|
+
* import { Buffer } from 'buffer';
|
|
319
|
+
*
|
|
320
|
+
* const str = '\u00bd + \u00bc = \u00be';
|
|
321
|
+
*
|
|
322
|
+
* console.log(`${str}: ${str.length} characters, ` +
|
|
323
|
+
* `${Buffer.byteLength(str, 'utf8')} bytes`);
|
|
324
|
+
* // Prints: ½ + ¼ = ¾: 9 characters, 12 bytes
|
|
325
|
+
* ```
|
|
326
|
+
*
|
|
327
|
+
* When `string` is a
|
|
328
|
+
* `Buffer`/[`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)/[`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/-
|
|
329
|
+
* Reference/Global_Objects/TypedArray)/[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)/[`SharedArrayBuffer`](https://develop-
|
|
330
|
+
* er.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), the byte length as reported by `.byteLength`is returned.
|
|
331
|
+
* @since v0.1.90
|
|
332
|
+
* @param string A value to calculate the length of.
|
|
333
|
+
* @param [encoding='utf8'] If `string` is a string, this is its encoding.
|
|
334
|
+
* @return The number of bytes contained within `string`.
|
|
266
335
|
*/
|
|
267
336
|
byteLength(string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number;
|
|
268
337
|
/**
|
|
269
|
-
* Returns a
|
|
338
|
+
* Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together.
|
|
339
|
+
*
|
|
340
|
+
* If the list has no items, or if the `totalLength` is 0, then a new zero-length`Buffer` is returned.
|
|
341
|
+
*
|
|
342
|
+
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
|
|
343
|
+
* in `list` by adding their lengths.
|
|
344
|
+
*
|
|
345
|
+
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
|
|
346
|
+
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
|
|
347
|
+
* truncated to `totalLength`.
|
|
348
|
+
*
|
|
349
|
+
* ```js
|
|
350
|
+
* import { Buffer } from 'buffer';
|
|
270
351
|
*
|
|
271
|
-
*
|
|
272
|
-
* If the list has exactly one item, then the first item of the list is returned.
|
|
273
|
-
* If the list has more than one item, then a new Buffer is created.
|
|
352
|
+
* // Create a single `Buffer` from a list of three `Buffer` instances.
|
|
274
353
|
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
354
|
+
* const buf1 = Buffer.alloc(10);
|
|
355
|
+
* const buf2 = Buffer.alloc(14);
|
|
356
|
+
* const buf3 = Buffer.alloc(18);
|
|
357
|
+
* const totalLength = buf1.length + buf2.length + buf3.length;
|
|
358
|
+
*
|
|
359
|
+
* console.log(totalLength);
|
|
360
|
+
* // Prints: 42
|
|
361
|
+
*
|
|
362
|
+
* const bufA = Buffer.concat([buf1, buf2, buf3], totalLength);
|
|
363
|
+
*
|
|
364
|
+
* console.log(bufA);
|
|
365
|
+
* // Prints: <Buffer 00 00 00 00 ...>
|
|
366
|
+
* console.log(bufA.length);
|
|
367
|
+
* // Prints: 42
|
|
368
|
+
* ```
|
|
369
|
+
*
|
|
370
|
+
* `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
|
371
|
+
* @since v0.7.11
|
|
372
|
+
* @param list List of `Buffer` or {@link Uint8Array} instances to concatenate.
|
|
373
|
+
* @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
|
|
278
374
|
*/
|
|
279
375
|
concat(list: ReadonlyArray<Uint8Array>, totalLength?: number): Buffer;
|
|
280
376
|
/**
|
|
281
|
-
*
|
|
377
|
+
* Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
|
|
378
|
+
*
|
|
379
|
+
* ```js
|
|
380
|
+
* import { Buffer } from 'buffer';
|
|
381
|
+
*
|
|
382
|
+
* const buf1 = Buffer.from('1234');
|
|
383
|
+
* const buf2 = Buffer.from('0123');
|
|
384
|
+
* const arr = [buf1, buf2];
|
|
385
|
+
*
|
|
386
|
+
* console.log(arr.sort(Buffer.compare));
|
|
387
|
+
* // Prints: [ <Buffer 30 31 32 33>, <Buffer 31 32 33 34> ]
|
|
388
|
+
* // (This result is equal to: [buf2, buf1].)
|
|
389
|
+
* ```
|
|
390
|
+
* @since v0.11.13
|
|
391
|
+
* @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details.
|
|
282
392
|
*/
|
|
283
393
|
compare(buf1: Uint8Array, buf2: Uint8Array): number;
|
|
284
394
|
/**
|
|
285
|
-
* Allocates a new
|
|
395
|
+
* Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
|
|
286
396
|
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
397
|
+
* ```js
|
|
398
|
+
* import { Buffer } from 'buffer';
|
|
399
|
+
*
|
|
400
|
+
* const buf = Buffer.alloc(5);
|
|
401
|
+
*
|
|
402
|
+
* console.log(buf);
|
|
403
|
+
* // Prints: <Buffer 00 00 00 00 00>
|
|
404
|
+
* ```
|
|
405
|
+
*
|
|
406
|
+
* If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_INVALID_ARG_VALUE` is thrown.
|
|
407
|
+
*
|
|
408
|
+
* If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
|
|
409
|
+
*
|
|
410
|
+
* ```js
|
|
411
|
+
* import { Buffer } from 'buffer';
|
|
412
|
+
*
|
|
413
|
+
* const buf = Buffer.alloc(5, 'a');
|
|
414
|
+
*
|
|
415
|
+
* console.log(buf);
|
|
416
|
+
* // Prints: <Buffer 61 61 61 61 61>
|
|
417
|
+
* ```
|
|
418
|
+
*
|
|
419
|
+
* If both `fill` and `encoding` are specified, the allocated `Buffer` will be
|
|
420
|
+
* initialized by calling `buf.fill(fill, encoding)`.
|
|
421
|
+
*
|
|
422
|
+
* ```js
|
|
423
|
+
* import { Buffer } from 'buffer';
|
|
424
|
+
*
|
|
425
|
+
* const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
|
|
426
|
+
*
|
|
427
|
+
* console.log(buf);
|
|
428
|
+
* // Prints: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
|
|
429
|
+
* ```
|
|
430
|
+
*
|
|
431
|
+
* Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance
|
|
432
|
+
* contents will never contain sensitive data from previous allocations, including
|
|
433
|
+
* data that might not have been allocated for `Buffer`s.
|
|
434
|
+
*
|
|
435
|
+
* A `TypeError` will be thrown if `size` is not a number.
|
|
436
|
+
* @since v5.10.0
|
|
437
|
+
* @param size The desired length of the new `Buffer`.
|
|
438
|
+
* @param [fill=0] A value to pre-fill the new `Buffer` with.
|
|
439
|
+
* @param [encoding='utf8'] If `fill` is a string, this is its encoding.
|
|
291
440
|
*/
|
|
292
441
|
alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
|
|
293
442
|
/**
|
|
294
|
-
* Allocates a new
|
|
295
|
-
*
|
|
443
|
+
* Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_INVALID_ARG_VALUE` is thrown.
|
|
444
|
+
*
|
|
445
|
+
* The underlying memory for `Buffer` instances created in this way is _not_
|
|
446
|
+
* _initialized_. The contents of the newly created `Buffer` are unknown and_may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes.
|
|
447
|
+
*
|
|
448
|
+
* ```js
|
|
449
|
+
* import { Buffer } from 'buffer';
|
|
450
|
+
*
|
|
451
|
+
* const buf = Buffer.allocUnsafe(10);
|
|
452
|
+
*
|
|
453
|
+
* console.log(buf);
|
|
454
|
+
* // Prints (contents may vary): <Buffer a0 8b 28 3f 01 00 00 00 50 32>
|
|
455
|
+
*
|
|
456
|
+
* buf.fill(0);
|
|
457
|
+
*
|
|
458
|
+
* console.log(buf);
|
|
459
|
+
* // Prints: <Buffer 00 00 00 00 00 00 00 00 00 00>
|
|
460
|
+
* ```
|
|
461
|
+
*
|
|
462
|
+
* A `TypeError` will be thrown if `size` is not a number.
|
|
463
|
+
*
|
|
464
|
+
* The `Buffer` module pre-allocates an internal `Buffer` instance of
|
|
465
|
+
* size `Buffer.poolSize` that is used as a pool for the fast allocation of new`Buffer` instances created using `Buffer.allocUnsafe()`,`Buffer.from(array)`, `Buffer.concat()`, and the
|
|
466
|
+
* deprecated`new Buffer(size)` constructor only when `size` is less than or equal
|
|
467
|
+
* to `Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two).
|
|
296
468
|
*
|
|
297
|
-
*
|
|
469
|
+
* Use of this pre-allocated internal memory pool is a key difference between
|
|
470
|
+
* calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
|
|
471
|
+
* Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less
|
|
472
|
+
* than or equal to half `Buffer.poolSize`. The
|
|
473
|
+
* difference is subtle but can be important when an application requires the
|
|
474
|
+
* additional performance that `Buffer.allocUnsafe()` provides.
|
|
475
|
+
* @since v5.10.0
|
|
476
|
+
* @param size The desired length of the new `Buffer`.
|
|
298
477
|
*/
|
|
299
478
|
allocUnsafe(size: number): Buffer;
|
|
300
479
|
/**
|
|
301
|
-
* Allocates a new
|
|
302
|
-
*
|
|
480
|
+
* Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_INVALID_ARG_VALUE` is thrown. A zero-length `Buffer` is created
|
|
481
|
+
* if `size` is 0.
|
|
482
|
+
*
|
|
483
|
+
* The underlying memory for `Buffer` instances created in this way is _not_
|
|
484
|
+
* _initialized_. The contents of the newly created `Buffer` are unknown and_may contain sensitive data_. Use `buf.fill(0)` to initialize
|
|
485
|
+
* such `Buffer` instances with zeroes.
|
|
486
|
+
*
|
|
487
|
+
* When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
|
|
488
|
+
* allocations under 4 KB are sliced from a single pre-allocated `Buffer`. This
|
|
489
|
+
* allows applications to avoid the garbage collection overhead of creating many
|
|
490
|
+
* individually allocated `Buffer` instances. This approach improves both
|
|
491
|
+
* performance and memory usage by eliminating the need to track and clean up as
|
|
492
|
+
* many individual `ArrayBuffer` objects.
|
|
493
|
+
*
|
|
494
|
+
* However, in the case where a developer may need to retain a small chunk of
|
|
495
|
+
* memory from a pool for an indeterminate amount of time, it may be appropriate
|
|
496
|
+
* to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and
|
|
497
|
+
* then copying out the relevant bits.
|
|
498
|
+
*
|
|
499
|
+
* ```js
|
|
500
|
+
* import { Buffer } from 'buffer';
|
|
501
|
+
*
|
|
502
|
+
* // Need to keep around a few small chunks of memory.
|
|
503
|
+
* const store = [];
|
|
504
|
+
*
|
|
505
|
+
* socket.on('readable', () => {
|
|
506
|
+
* let data;
|
|
507
|
+
* while (null !== (data = readable.read())) {
|
|
508
|
+
* // Allocate for retained data.
|
|
509
|
+
* const sb = Buffer.allocUnsafeSlow(10);
|
|
510
|
+
*
|
|
511
|
+
* // Copy the data into the new allocation.
|
|
512
|
+
* data.copy(sb, 0, 0, 10);
|
|
513
|
+
*
|
|
514
|
+
* store.push(sb);
|
|
515
|
+
* }
|
|
516
|
+
* });
|
|
517
|
+
* ```
|
|
303
518
|
*
|
|
304
|
-
*
|
|
519
|
+
* A `TypeError` will be thrown if `size` is not a number.
|
|
520
|
+
* @since v5.12.0
|
|
521
|
+
* @param size The desired length of the new `Buffer`.
|
|
305
522
|
*/
|
|
306
523
|
allocUnsafeSlow(size: number): Buffer;
|
|
307
524
|
/**
|
|
308
|
-
* This is the
|
|
525
|
+
* This is the size (in bytes) of pre-allocated internal `Buffer` instances used
|
|
526
|
+
* for pooling. This value may be modified.
|
|
527
|
+
* @since v0.11.3
|
|
309
528
|
*/
|
|
310
529
|
poolSize: number;
|
|
311
530
|
}
|
node/child_process.d.ts
CHANGED
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
|
|
61
61
|
* the synchronous methods can have significant impact on performance due to
|
|
62
62
|
* stalling the event loop while spawned processes complete.
|
|
63
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
63
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/child_process.js)
|
|
64
64
|
*/
|
|
65
65
|
declare module 'child_process' {
|
|
66
66
|
import { ObjectEncodingOptions } from 'node:fs';
|
|
@@ -1248,7 +1248,7 @@ declare module 'child_process' {
|
|
|
1248
1248
|
}
|
|
1249
1249
|
interface SpawnSyncReturns<T> {
|
|
1250
1250
|
pid: number;
|
|
1251
|
-
output:
|
|
1251
|
+
output: Array<T | null>;
|
|
1252
1252
|
stdout: T;
|
|
1253
1253
|
stderr: T;
|
|
1254
1254
|
status: number | null;
|
node/cluster.d.ts
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
* ```
|
|
50
50
|
*
|
|
51
51
|
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
|
52
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
52
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/cluster.js)
|
|
53
53
|
*/
|
|
54
54
|
declare module 'cluster' {
|
|
55
55
|
import * as child from 'node:child_process';
|
node/console.d.ts
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
* myConsole.warn(`Danger ${name}! Danger!`);
|
|
54
54
|
* // Prints: Danger Will Robinson! Danger!, to err
|
|
55
55
|
* ```
|
|
56
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
56
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/console.js)
|
|
57
57
|
*/
|
|
58
58
|
declare module 'console' {
|
|
59
59
|
import console = require('node:console');
|
node/crypto.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* // Prints:
|
|
14
14
|
* // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
|
|
15
15
|
* ```
|
|
16
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
16
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/crypto.js)
|
|
17
17
|
*/
|
|
18
18
|
declare module 'crypto' {
|
|
19
19
|
import * as stream from 'node:stream';
|
|
@@ -2791,7 +2791,7 @@ declare module 'crypto' {
|
|
|
2791
2791
|
*/
|
|
2792
2792
|
function getCipherInfo(nameOrNid: string | number, options?: CipherInfoOptions): CipherInfo | undefined;
|
|
2793
2793
|
/**
|
|
2794
|
-
* HKDF is a simple key derivation function defined in RFC 5869\. The given `
|
|
2794
|
+
* HKDF is a simple key derivation function defined in RFC 5869\. The given `ikm`,`salt` and `info` are used with the `digest` to derive a key of `keylen` bytes.
|
|
2795
2795
|
*
|
|
2796
2796
|
* The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an errors occurs while deriving the key, `err` will be set;
|
|
2797
2797
|
* otherwise `err` will be `null`. The successfully generated `derivedKey` will
|
|
@@ -2811,16 +2811,16 @@ declare module 'crypto' {
|
|
|
2811
2811
|
* ```
|
|
2812
2812
|
* @since v15.0.0
|
|
2813
2813
|
* @param digest The digest algorithm to use.
|
|
2814
|
-
* @param
|
|
2814
|
+
* @param ikm The input keying material. It must be at least one byte in length.
|
|
2815
2815
|
* @param salt The salt value. Must be provided but can be zero-length.
|
|
2816
2816
|
* @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes.
|
|
2817
2817
|
* @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512`
|
|
2818
2818
|
* generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
|
|
2819
2819
|
*/
|
|
2820
|
-
function hkdf(digest: string,
|
|
2820
|
+
function hkdf(digest: string, irm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: ArrayBuffer) => void): void;
|
|
2821
2821
|
/**
|
|
2822
2822
|
* Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The
|
|
2823
|
-
* given `
|
|
2823
|
+
* given `ikm`, `salt` and `info` are used with the `digest` to derive a key of`keylen` bytes.
|
|
2824
2824
|
*
|
|
2825
2825
|
* The successfully generated `derivedKey` will be returned as an [<ArrayBuffer>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer).
|
|
2826
2826
|
*
|
|
@@ -2838,13 +2838,13 @@ declare module 'crypto' {
|
|
|
2838
2838
|
* ```
|
|
2839
2839
|
* @since v15.0.0
|
|
2840
2840
|
* @param digest The digest algorithm to use.
|
|
2841
|
-
* @param
|
|
2841
|
+
* @param ikm The input keying material. It must be at least one byte in length.
|
|
2842
2842
|
* @param salt The salt value. Must be provided but can be zero-length.
|
|
2843
2843
|
* @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes.
|
|
2844
2844
|
* @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512`
|
|
2845
2845
|
* generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
|
|
2846
2846
|
*/
|
|
2847
|
-
function hkdfSync(digest: string,
|
|
2847
|
+
function hkdfSync(digest: string, ikm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number): ArrayBuffer;
|
|
2848
2848
|
interface SecureHeapUsage {
|
|
2849
2849
|
/**
|
|
2850
2850
|
* The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag.
|
|
@@ -2879,7 +2879,7 @@ declare module 'crypto' {
|
|
|
2879
2879
|
disableEntropyCache?: boolean | undefined;
|
|
2880
2880
|
}
|
|
2881
2881
|
/**
|
|
2882
|
-
* Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt)
|
|
2882
|
+
* Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a
|
|
2883
2883
|
* cryptographic pseudorandom number generator.
|
|
2884
2884
|
* @since v15.6.0
|
|
2885
2885
|
*/
|
|
@@ -2967,7 +2967,7 @@ declare module 'crypto' {
|
|
|
2967
2967
|
*/
|
|
2968
2968
|
readonly issuerCertificate?: X509Certificate | undefined;
|
|
2969
2969
|
/**
|
|
2970
|
-
* The public key
|
|
2970
|
+
* The public key `KeyObject` for this certificate.
|
|
2971
2971
|
* @since v15.6.0
|
|
2972
2972
|
*/
|
|
2973
2973
|
readonly publicKey: KeyObject;
|
node/dgram.d.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* server.bind(41234);
|
|
24
24
|
* // Prints: server listening 0.0.0.0:41234
|
|
25
25
|
* ```
|
|
26
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
26
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/dgram.js)
|
|
27
27
|
*/
|
|
28
28
|
declare module 'dgram' {
|
|
29
29
|
import { AddressInfo } from 'node:net';
|
node/diagnostics_channel.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* should generally include the module name to avoid collisions with data from
|
|
21
21
|
* other modules.
|
|
22
22
|
* @experimental
|
|
23
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
23
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/diagnostics_channel.js)
|
|
24
24
|
*/
|
|
25
25
|
declare module 'diagnostics_channel' {
|
|
26
26
|
/**
|
node/dns.d.ts
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
44
|
* See the `Implementation considerations section` for more information.
|
|
45
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
45
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/dns.js)
|
|
46
46
|
*/
|
|
47
47
|
declare module 'dns' {
|
|
48
48
|
import * as dnsPromises from 'node:dns/promises';
|
|
@@ -553,6 +553,10 @@ declare module 'dns' {
|
|
|
553
553
|
export const CANCELLED: string;
|
|
554
554
|
export interface ResolverOptions {
|
|
555
555
|
timeout?: number | undefined;
|
|
556
|
+
/**
|
|
557
|
+
* @default 4
|
|
558
|
+
*/
|
|
559
|
+
tries?: number;
|
|
556
560
|
}
|
|
557
561
|
/**
|
|
558
562
|
* An independent resolver for DNS requests.
|
node/domain.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
|
|
12
12
|
* exit immediately with an error code.
|
|
13
13
|
* @deprecated Since v1.4.2 - Deprecated
|
|
14
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
14
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/domain.js)
|
|
15
15
|
*/
|
|
16
16
|
declare module 'domain' {
|
|
17
17
|
import EventEmitter = require('node:events');
|