@types/node 15.14.7 → 16.0.1

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.
Files changed (65) hide show
  1. {node v15.14 → node}/LICENSE +0 -0
  2. node v15.14/README.md → node/README.md +3 -3
  3. node/assert/strict.d.ts +9 -0
  4. node v15.14/assert.d.ts → node/assert.d.ts +35 -30
  5. node v15.14/async_hooks.d.ts → node/async_hooks.d.ts +7 -3
  6. {node v15.14 → node}/base.d.ts +0 -0
  7. node/buffer.d.ts +357 -0
  8. node v15.14/child_process.d.ts → node/child_process.d.ts +54 -50
  9. node v15.14/cluster.d.ts → node/cluster.d.ts +33 -108
  10. node v15.14/console.d.ts → node/console.d.ts +24 -23
  11. node v15.14/constants.d.ts → node/constants.d.ts +5 -0
  12. node v15.14/crypto.d.ts → node/crypto.d.ts +82 -67
  13. node v15.14/dgram.d.ts → node/dgram.d.ts +13 -9
  14. node v15.14/diagnostic_channel.d.ts → node/diagnostic_channel.d.ts +4 -0
  15. node v15.14/dns/promises.d.ts → node/dns/promises.d.ts +4 -0
  16. node v15.14/dns.d.ts → node/dns.d.ts +15 -11
  17. node/domain.d.ts +25 -0
  18. node v15.14/events.d.ts → node/events.d.ts +8 -3
  19. node v15.14/fs/promises.d.ts → node/fs/promises.d.ts +25 -17
  20. node v15.14/fs.d.ts → node/fs.d.ts +71 -75
  21. node/globals.d.ts +274 -0
  22. node/globals.global.d.ts +1 -0
  23. node v15.14/http.d.ts → node/http.d.ts +109 -167
  24. node v15.14/http2.d.ts → node/http2.d.ts +69 -66
  25. node/https.d.ts +40 -0
  26. node v15.14/index.d.ts → node/index.d.ts +1 -1
  27. node v15.14/inspector.d.ts → node/inspector.d.ts +152 -470
  28. node v15.14/module.d.ts → node/module.d.ts +25 -4
  29. node v15.14/net.d.ts → node/net.d.ts +34 -36
  30. node v15.14/os.d.ts → node/os.d.ts +4 -0
  31. node v15.14/package.json → node/package.json +2 -2
  32. node v15.14/path.d.ts → node/path.d.ts +10 -5
  33. node v15.14/perf_hooks.d.ts → node/perf_hooks.d.ts +70 -23
  34. node v15.14/process.d.ts → node/process.d.ts +54 -51
  35. node v15.14/punycode.d.ts → node/punycode.d.ts +4 -0
  36. node v15.14/querystring.d.ts → node/querystring.d.ts +7 -3
  37. node v15.14/readline.d.ts → node/readline.d.ts +20 -16
  38. node v15.14/repl.d.ts → node/repl.d.ts +18 -14
  39. node v15.14/stream/promises.d.ts → node/stream/promises.d.ts +4 -0
  40. node v15.14/stream.d.ts → node/stream.d.ts +22 -17
  41. node v15.14/string_decoder.d.ts → node/string_decoder.d.ts +4 -0
  42. node v15.14/timers/promises.d.ts → node/timers/promises.d.ts +4 -0
  43. node/timers.d.ts +92 -0
  44. node v15.14/tls.d.ts → node/tls.d.ts +54 -50
  45. node v15.14/trace_events.d.ts → node/trace_events.d.ts +4 -0
  46. node v15.14/ts3.6/assert.d.ts → node/ts3.6/assert.d.ts +26 -26
  47. {node v15.14 → node}/ts3.6/base.d.ts +0 -0
  48. {node v15.14 → node}/ts3.6/index.d.ts +0 -0
  49. node v15.14/tty.d.ts → node/tty.d.ts +4 -0
  50. node v15.14/url.d.ts → node/url.d.ts +19 -15
  51. node/util/types.d.ts +57 -0
  52. node v15.14/util.d.ts → node/util.d.ts +67 -21
  53. node v15.14/v8.d.ts → node/v8.d.ts +4 -0
  54. node v15.14/vm.d.ts → node/vm.d.ts +28 -24
  55. node v15.14/wasi.d.ts → node/wasi.d.ts +11 -7
  56. node v15.14/worker_threads.d.ts → node/worker_threads.d.ts +19 -15
  57. node v15.14/zlib.d.ts → node/zlib.d.ts +20 -16
  58. node v15.14/assert/strict.d.ts +0 -4
  59. node v15.14/buffer.d.ts +0 -112
  60. node v15.14/domain.d.ts +0 -24
  61. node v15.14/globals.d.ts +0 -659
  62. node v15.14/globals.global.d.ts +0 -1
  63. node v15.14/https.d.ts +0 -139
  64. node v15.14/timers.d.ts +0 -27
  65. node v15.14/util/types.d.ts +0 -53
File without changes
@@ -5,12 +5,12 @@
5
5
  This package contains type definitions for Node.js (http://nodejs.org/).
6
6
 
7
7
  # Details
8
- Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v15.
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 04 Aug 2021 16:31:29 GMT
11
+ * Last updated: Wed, 07 Jul 2021 16:31:27 GMT
12
12
  * Dependencies: none
13
- * Global values: `AbortController`, `AbortSignal`, `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
13
+ * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
14
14
 
15
15
  # Credits
16
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), [Hoàng Văn Khải](https://github.com/KSXGitHub), [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), [Jason Kwok](https://github.com/JasonHK), [Victor Perin](https://github.com/victorperin), and [Yongsheng Zhang](https://github.com/ZYSzys).
@@ -0,0 +1,9 @@
1
+ declare module 'assert/strict' {
2
+ import { strict } from 'assert';
3
+ export = strict;
4
+ }
5
+
6
+ declare module 'node:assert/strict' {
7
+ import * as assert from 'assert/strict';
8
+ export = assert;
9
+ }
@@ -1,26 +1,26 @@
1
1
  declare module 'assert' {
2
2
  /** An alias of `assert.ok()`. */
3
- function assert(value: any, message?: string | Error): asserts value;
3
+ function assert(value: unknown, message?: string | Error): asserts value;
4
4
  namespace assert {
5
5
  class AssertionError extends Error {
6
- actual: any;
7
- expected: any;
6
+ actual: unknown;
7
+ expected: unknown;
8
8
  operator: string;
9
9
  generatedMessage: boolean;
10
10
  code: 'ERR_ASSERTION';
11
11
 
12
12
  constructor(options?: {
13
13
  /** If provided, the error message is set to this value. */
14
- message?: string;
14
+ message?: string | undefined;
15
15
  /** The `actual` property on the error instance. */
16
- actual?: any;
16
+ actual?: unknown | undefined;
17
17
  /** The `expected` property on the error instance. */
18
- expected?: any;
18
+ expected?: unknown | undefined;
19
19
  /** The `operator` property on the error instance. */
20
- operator?: string;
20
+ operator?: string | undefined;
21
21
  /** If provided, the generated stack trace omits frames before this function. */
22
22
  // tslint:disable-next-line:ban-types
23
- stackStartFn?: Function;
23
+ stackStartFn?: Function | undefined;
24
24
  });
25
25
  }
26
26
 
@@ -42,48 +42,48 @@ declare module 'assert' {
42
42
  stack: object;
43
43
  }
44
44
 
45
- type AssertPredicate = RegExp | (new () => object) | ((thrown: any) => boolean) | object | Error;
45
+ type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error;
46
46
 
47
47
  function fail(message?: string | Error): never;
48
48
  /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
49
49
  function fail(
50
- actual: any,
51
- expected: any,
50
+ actual: unknown,
51
+ expected: unknown,
52
52
  message?: string | Error,
53
53
  operator?: string,
54
54
  // tslint:disable-next-line:ban-types
55
55
  stackStartFn?: Function,
56
56
  ): never;
57
- function ok(value: any, message?: string | Error): asserts value;
57
+ function ok(value: unknown, message?: string | Error): asserts value;
58
58
  /** @deprecated since v9.9.0 - use strictEqual() instead. */
59
- function equal(actual: any, expected: any, message?: string | Error): void;
59
+ function equal(actual: unknown, expected: unknown, message?: string | Error): void;
60
60
  /** @deprecated since v9.9.0 - use notStrictEqual() instead. */
61
- function notEqual(actual: any, expected: any, message?: string | Error): void;
61
+ function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
62
62
  /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
63
- function deepEqual(actual: any, expected: any, message?: string | Error): void;
63
+ function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
64
64
  /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
65
- function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
66
- function strictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
67
- function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
68
- function deepStrictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
69
- function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
65
+ function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
66
+ function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
67
+ function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
68
+ function deepStrictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
69
+ function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
70
70
 
71
- function throws(block: () => any, message?: string | Error): void;
72
- function throws(block: () => any, error: AssertPredicate, message?: string | Error): void;
73
- function doesNotThrow(block: () => any, message?: string | Error): void;
74
- function doesNotThrow(block: () => any, error: AssertPredicate, message?: string | Error): void;
71
+ function throws(block: () => unknown, message?: string | Error): void;
72
+ function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
73
+ function doesNotThrow(block: () => unknown, message?: string | Error): void;
74
+ function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
75
75
 
76
- function ifError(value: any): asserts value is null | undefined;
76
+ function ifError(value: unknown): asserts value is null | undefined;
77
77
 
78
- function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
78
+ function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
79
79
  function rejects(
80
- block: (() => Promise<any>) | Promise<any>,
80
+ block: (() => Promise<unknown>) | Promise<unknown>,
81
81
  error: AssertPredicate,
82
82
  message?: string | Error,
83
83
  ): Promise<void>;
84
- function doesNotReject(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
84
+ function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
85
85
  function doesNotReject(
86
- block: (() => Promise<any>) | Promise<any>,
86
+ block: (() => Promise<unknown>) | Promise<unknown>,
87
87
  error: AssertPredicate,
88
88
  message?: string | Error,
89
89
  ): Promise<void>;
@@ -103,7 +103,7 @@ declare module 'assert' {
103
103
  | 'ifError'
104
104
  | 'strict'
105
105
  > & {
106
- (value: any, message?: string | Error): asserts value;
106
+ (value: unknown, message?: string | Error): asserts value;
107
107
  equal: typeof strictEqual;
108
108
  notEqual: typeof notStrictEqual;
109
109
  deepEqual: typeof deepStrictEqual;
@@ -122,3 +122,8 @@ declare module 'assert' {
122
122
 
123
123
  export = assert;
124
124
  }
125
+
126
+ declare module 'node:assert' {
127
+ import assert = require('assert');
128
+ export = assert;
129
+ }
@@ -87,7 +87,7 @@ declare module 'async_hooks' {
87
87
  * The ID of the execution context that created this async event.
88
88
  * @default executionAsyncId()
89
89
  */
90
- triggerAsyncId?: number;
90
+ triggerAsyncId?: number | undefined;
91
91
 
92
92
  /**
93
93
  * Disables automatic `emitDestroy` when the object is garbage collected.
@@ -96,7 +96,7 @@ declare module 'async_hooks' {
96
96
  * sensitive API's `emitDestroy` is called with it.
97
97
  * @default false
98
98
  */
99
- requireManualDestroy?: boolean;
99
+ requireManualDestroy?: boolean | undefined;
100
100
  }
101
101
 
102
102
  /**
@@ -120,7 +120,7 @@ declare module 'async_hooks' {
120
120
  * @param fn The function to bind to the current execution context.
121
121
  * @param type An optional name to associate with the underlying `AsyncResource`.
122
122
  */
123
- static bind<Func extends (...args: any[]) => any>(fn: Func, type?: string): Func & { asyncResource: AsyncResource };
123
+ static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(fn: Func, type?: string, thisArg?: ThisArg): Func & { asyncResource: AsyncResource };
124
124
 
125
125
  /**
126
126
  * Binds the given function to execute to this `AsyncResource`'s scope.
@@ -224,3 +224,7 @@ declare module 'async_hooks' {
224
224
  enterWith(store: T): void;
225
225
  }
226
226
  }
227
+
228
+ declare module 'node:async_hooks' {
229
+ export * from 'async_hooks';
230
+ }
File without changes
node/buffer.d.ts ADDED
@@ -0,0 +1,357 @@
1
+ declare module 'buffer' {
2
+ import { BinaryLike } from 'crypto';
3
+
4
+ export const INSPECT_MAX_BYTES: number;
5
+ export const kMaxLength: number;
6
+ export const kStringMaxLength: number;
7
+ export const constants: {
8
+ MAX_LENGTH: number;
9
+ MAX_STRING_LENGTH: number;
10
+ };
11
+
12
+ export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary";
13
+
14
+ export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
15
+
16
+ export const SlowBuffer: {
17
+ /** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */
18
+ new(size: number): Buffer;
19
+ prototype: Buffer;
20
+ };
21
+
22
+ export { Buffer };
23
+
24
+ /**
25
+ * @experimental
26
+ */
27
+ export interface BlobOptions {
28
+ /**
29
+ * @default 'utf8'
30
+ */
31
+ encoding?: BufferEncoding | undefined;
32
+
33
+ /**
34
+ * The Blob content-type. The intent is for `type` to convey
35
+ * the MIME media type of the data, however no validation of the type format
36
+ * is performed.
37
+ */
38
+ type?: string | undefined;
39
+ }
40
+
41
+ /**
42
+ * @experimental
43
+ */
44
+ export class Blob {
45
+ /**
46
+ * Returns a promise that fulfills with an {ArrayBuffer} containing a copy of the `Blob` data.
47
+ */
48
+ readonly size: number;
49
+
50
+ /**
51
+ * The content-type of the `Blob`.
52
+ */
53
+ readonly type: string;
54
+
55
+ /**
56
+ * Creates a new `Blob` object containing a concatenation of the given sources.
57
+ *
58
+ * {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into
59
+ * the 'Blob' and can therefore be safely modified after the 'Blob' is created.
60
+ *
61
+ * String sources are also copied into the `Blob`.
62
+ */
63
+ constructor(sources: Array<(BinaryLike | Blob)>, options?: BlobOptions);
64
+
65
+ arrayBuffer(): Promise<ArrayBuffer>;
66
+
67
+ /**
68
+ * @param start The starting index.
69
+ * @param end The ending index.
70
+ * @param type The content-type for the new `Blob`
71
+ */
72
+ slice(start?: number, end?: number, type?: string): Blob;
73
+
74
+ /**
75
+ * Returns a promise that resolves the contents of the `Blob` decoded as a UTF-8 string.
76
+ */
77
+ text(): Promise<string>;
78
+ }
79
+
80
+ export import atob = globalThis.atob;
81
+ export import btoa = globalThis.btoa;
82
+
83
+ global {
84
+ // Buffer class
85
+ type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex";
86
+
87
+ type WithImplicitCoercion<T> = T | { valueOf(): T };
88
+
89
+ /**
90
+ * Raw data is stored in instances of the Buffer class.
91
+ * 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.
92
+ * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
93
+ */
94
+ class Buffer extends Uint8Array {
95
+ /**
96
+ * Allocates a new buffer containing the given {str}.
97
+ *
98
+ * @param str String to store in buffer.
99
+ * @param encoding encoding to use, optional. Default is 'utf8'
100
+ * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
101
+ */
102
+ constructor(str: string, encoding?: BufferEncoding);
103
+ /**
104
+ * Allocates a new buffer of {size} octets.
105
+ *
106
+ * @param size count of octets to allocate.
107
+ * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
108
+ */
109
+ constructor(size: number);
110
+ /**
111
+ * Allocates a new buffer containing the given {array} of octets.
112
+ *
113
+ * @param array The octets to store.
114
+ * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
115
+ */
116
+ constructor(array: Uint8Array);
117
+ /**
118
+ * Produces a Buffer backed by the same allocated memory as
119
+ * the given {ArrayBuffer}/{SharedArrayBuffer}.
120
+ *
121
+ *
122
+ * @param arrayBuffer The ArrayBuffer with which to share memory.
123
+ * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
124
+ */
125
+ constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer);
126
+ /**
127
+ * Allocates a new buffer containing the given {array} of octets.
128
+ *
129
+ * @param array The octets to store.
130
+ * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
131
+ */
132
+ constructor(array: ReadonlyArray<any>);
133
+ /**
134
+ * Copies the passed {buffer} data onto a new {Buffer} instance.
135
+ *
136
+ * @param buffer The buffer to copy.
137
+ * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
138
+ */
139
+ constructor(buffer: Buffer);
140
+ /**
141
+ * When passed a reference to the .buffer property of a TypedArray instance,
142
+ * the newly created Buffer will share the same allocated memory as the TypedArray.
143
+ * The optional {byteOffset} and {length} arguments specify a memory range
144
+ * within the {arrayBuffer} that will be shared by the Buffer.
145
+ *
146
+ * @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer()
147
+ */
148
+ static from(arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>, byteOffset?: number, length?: number): Buffer;
149
+ /**
150
+ * Creates a new Buffer using the passed {data}
151
+ * @param data data to create a new Buffer
152
+ */
153
+ static from(data: Uint8Array | ReadonlyArray<number>): Buffer;
154
+ static from(data: WithImplicitCoercion<Uint8Array | ReadonlyArray<number> | string>): Buffer;
155
+ /**
156
+ * Creates a new Buffer containing the given JavaScript string {str}.
157
+ * If provided, the {encoding} parameter identifies the character encoding.
158
+ * If not provided, {encoding} defaults to 'utf8'.
159
+ */
160
+ static from(str: WithImplicitCoercion<string> | { [Symbol.toPrimitive](hint: 'string'): string }, encoding?: BufferEncoding): Buffer;
161
+ /**
162
+ * Creates a new Buffer using the passed {data}
163
+ * @param values to create a new Buffer
164
+ */
165
+ static of(...items: number[]): Buffer;
166
+ /**
167
+ * Returns true if {obj} is a Buffer
168
+ *
169
+ * @param obj object to test.
170
+ */
171
+ static isBuffer(obj: any): obj is Buffer;
172
+ /**
173
+ * Returns true if {encoding} is a valid encoding argument.
174
+ * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
175
+ *
176
+ * @param encoding string to test.
177
+ */
178
+ static isEncoding(encoding: string): encoding is BufferEncoding;
179
+ /**
180
+ * Gives the actual byte length of a string. encoding defaults to 'utf8'.
181
+ * This is not the same as String.prototype.length since that returns the number of characters in a string.
182
+ *
183
+ * @param string string to test.
184
+ * @param encoding encoding used to evaluate (defaults to 'utf8')
185
+ */
186
+ static byteLength(
187
+ string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
188
+ encoding?: BufferEncoding
189
+ ): number;
190
+ /**
191
+ * Returns a buffer which is the result of concatenating all the buffers in the list together.
192
+ *
193
+ * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
194
+ * If the list has exactly one item, then the first item of the list is returned.
195
+ * If the list has more than one item, then a new Buffer is created.
196
+ *
197
+ * @param list An array of Buffer objects to concatenate
198
+ * @param totalLength Total length of the buffers when concatenated.
199
+ * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
200
+ */
201
+ static concat(list: ReadonlyArray<Uint8Array>, totalLength?: number): Buffer;
202
+ /**
203
+ * The same as buf1.compare(buf2).
204
+ */
205
+ static compare(buf1: Uint8Array, buf2: Uint8Array): number;
206
+ /**
207
+ * Allocates a new buffer of {size} octets.
208
+ *
209
+ * @param size count of octets to allocate.
210
+ * @param fill if specified, buffer will be initialized by calling buf.fill(fill).
211
+ * If parameter is omitted, buffer will be filled with zeros.
212
+ * @param encoding encoding used for call to buf.fill while initalizing
213
+ */
214
+ static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
215
+ /**
216
+ * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
217
+ * of the newly created Buffer are unknown and may contain sensitive data.
218
+ *
219
+ * @param size count of octets to allocate
220
+ */
221
+ static allocUnsafe(size: number): Buffer;
222
+ /**
223
+ * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
224
+ * of the newly created Buffer are unknown and may contain sensitive data.
225
+ *
226
+ * @param size count of octets to allocate
227
+ */
228
+ static allocUnsafeSlow(size: number): Buffer;
229
+ /**
230
+ * This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified.
231
+ */
232
+ static poolSize: number;
233
+
234
+ write(string: string, encoding?: BufferEncoding): number;
235
+ write(string: string, offset: number, encoding?: BufferEncoding): number;
236
+ write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
237
+ toString(encoding?: BufferEncoding, start?: number, end?: number): string;
238
+ toJSON(): { type: 'Buffer'; data: number[] };
239
+ equals(otherBuffer: Uint8Array): boolean;
240
+ compare(
241
+ otherBuffer: Uint8Array,
242
+ targetStart?: number,
243
+ targetEnd?: number,
244
+ sourceStart?: number,
245
+ sourceEnd?: number
246
+ ): number;
247
+ copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
248
+ /**
249
+ * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
250
+ *
251
+ * This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory.
252
+ *
253
+ * @param begin Where the new `Buffer` will start. Default: `0`.
254
+ * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
255
+ */
256
+ slice(begin?: number, end?: number): Buffer;
257
+ /**
258
+ * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
259
+ *
260
+ * This method is compatible with `Uint8Array#subarray()`.
261
+ *
262
+ * @param begin Where the new `Buffer` will start. Default: `0`.
263
+ * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
264
+ */
265
+ subarray(begin?: number, end?: number): Buffer;
266
+ writeBigInt64BE(value: bigint, offset?: number): number;
267
+ writeBigInt64LE(value: bigint, offset?: number): number;
268
+ writeBigUInt64BE(value: bigint, offset?: number): number;
269
+ writeBigUInt64LE(value: bigint, offset?: number): number;
270
+ writeUIntLE(value: number, offset: number, byteLength: number): number;
271
+ writeUIntBE(value: number, offset: number, byteLength: number): number;
272
+ writeIntLE(value: number, offset: number, byteLength: number): number;
273
+ writeIntBE(value: number, offset: number, byteLength: number): number;
274
+ readBigUInt64BE(offset?: number): bigint;
275
+ readBigUInt64LE(offset?: number): bigint;
276
+ readBigInt64BE(offset?: number): bigint;
277
+ readBigInt64LE(offset?: number): bigint;
278
+ readUIntLE(offset: number, byteLength: number): number;
279
+ readUIntBE(offset: number, byteLength: number): number;
280
+ readIntLE(offset: number, byteLength: number): number;
281
+ readIntBE(offset: number, byteLength: number): number;
282
+ readUInt8(offset?: number): number;
283
+ readUInt16LE(offset?: number): number;
284
+ readUInt16BE(offset?: number): number;
285
+ readUInt32LE(offset?: number): number;
286
+ readUInt32BE(offset?: number): number;
287
+ readInt8(offset?: number): number;
288
+ readInt16LE(offset?: number): number;
289
+ readInt16BE(offset?: number): number;
290
+ readInt32LE(offset?: number): number;
291
+ readInt32BE(offset?: number): number;
292
+ readFloatLE(offset?: number): number;
293
+ readFloatBE(offset?: number): number;
294
+ readDoubleLE(offset?: number): number;
295
+ readDoubleBE(offset?: number): number;
296
+ reverse(): this;
297
+ swap16(): Buffer;
298
+ swap32(): Buffer;
299
+ swap64(): Buffer;
300
+ writeUInt8(value: number, offset?: number): number;
301
+ writeUInt16LE(value: number, offset?: number): number;
302
+ writeUInt16BE(value: number, offset?: number): number;
303
+ writeUInt32LE(value: number, offset?: number): number;
304
+ writeUInt32BE(value: number, offset?: number): number;
305
+ writeInt8(value: number, offset?: number): number;
306
+ writeInt16LE(value: number, offset?: number): number;
307
+ writeInt16BE(value: number, offset?: number): number;
308
+ writeInt32LE(value: number, offset?: number): number;
309
+ writeInt32BE(value: number, offset?: number): number;
310
+ writeFloatLE(value: number, offset?: number): number;
311
+ writeFloatBE(value: number, offset?: number): number;
312
+ writeDoubleLE(value: number, offset?: number): number;
313
+ writeDoubleBE(value: number, offset?: number): number;
314
+
315
+ fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
316
+
317
+ indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
318
+ lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
319
+ entries(): IterableIterator<[number, number]>;
320
+ includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
321
+ keys(): IterableIterator<number>;
322
+ values(): IterableIterator<number>;
323
+ }
324
+
325
+ /**
326
+ * Decodes a string of Base64-encoded data into bytes, and encodes those bytes into a string using Latin-1 (ISO-8859-1).
327
+ *
328
+ * This function is only provided for compatibility with legacy web platform APIs
329
+ * and should never be used in new code, because they use strings to represent
330
+ * binary data and predate the introduction of typed arrays in JavaScript.
331
+ * For code running using Node.js APIs, converting between base64-encoded strings
332
+ * and binary data should be performed using `Buffer.from(str, 'base64')` and
333
+ * `buf.toString('base64')`.
334
+ *
335
+ * @deprecated dom compatibility
336
+ */
337
+ function atob(input: string): string;
338
+
339
+ /**
340
+ * Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes into a string using Base64.
341
+ *
342
+ * This function is only provided for compatibility with legacy web platform APIs
343
+ * and should never be used in new code, because they use strings to represent
344
+ * binary data and predate the introduction of typed arrays in JavaScript.
345
+ * For code running using Node.js APIs, converting between base64-encoded strings
346
+ * and binary data should be performed using `Buffer.from(str, 'base64')` and
347
+ * `buf.toString('base64')`.
348
+ *
349
+ * @deprecated dom compatibility
350
+ */
351
+ function btoa(input: string): string;
352
+ }
353
+ }
354
+
355
+ declare module 'node:buffer' {
356
+ export * from 'buffer';
357
+ }