@types/node 16.4.1 → 16.4.5
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/assert/strict.d.ts +0 -1
- node/assert.d.ts +1352 -40
- node/async_hooks.d.ts +359 -90
- node/buffer.d.ts +1503 -78
- node/child_process.d.ts +1054 -233
- node/cluster.d.ts +320 -100
- node/console.d.ts +305 -32
- node/crypto.d.ts +3115 -739
- node/dgram.d.ts +446 -55
- node/diagnostics_channel.d.ts +85 -12
- node/dns/promises.d.ts +292 -36
- node/dns.d.ts +410 -97
- node/domain.d.ts +154 -10
- node/events.d.ts +377 -31
- node/fs/promises.d.ts +697 -273
- node/fs.d.ts +2257 -858
- node/http.d.ts +889 -81
- node/http2.d.ts +1520 -459
- node/https.d.ts +261 -11
- node/index.d.ts +25 -0
- node/inspector.d.ts +354 -661
- node/module.d.ts +49 -11
- node/net.d.ts +548 -140
- node/os.d.ts +236 -26
- node/package.json +7 -2
- node/path.d.ts +9 -5
- node/perf_hooks.d.ts +288 -90
- node/process.d.ts +1092 -153
- node/punycode.d.ts +65 -26
- node/querystring.d.ts +107 -8
- node/readline.d.ts +425 -79
- node/repl.d.ts +135 -110
- node/stream/promises.d.ts +15 -44
- node/stream.d.ts +927 -225
- node/string_decoder.d.ts +57 -1
- node/timers/promises.d.ts +97 -9
- node/timers.d.ts +29 -10
- node/tls.d.ts +444 -221
- node/trace_events.d.ts +107 -11
- node/tty.d.ts +163 -23
- node/url.d.ts +739 -29
- node/util.d.ts +1361 -73
- node/v8.d.ts +254 -78
- node/vm.d.ts +381 -33
- node/wasi.d.ts +107 -24
- node/worker_threads.d.ts +494 -131
- node/zlib.d.ts +215 -63
node/v8.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/)built into the Node.js binary. It can be accessed using:
|
|
3
|
+
*
|
|
4
|
+
* ```js
|
|
5
|
+
* const v8 = require('v8');
|
|
6
|
+
* ```
|
|
7
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/v8.js)
|
|
8
|
+
*/
|
|
1
9
|
declare module 'v8' {
|
|
2
10
|
import { Readable } from 'node:stream';
|
|
3
|
-
|
|
4
11
|
interface HeapSpaceInfo {
|
|
5
12
|
space_name: string;
|
|
6
13
|
space_size: number;
|
|
@@ -8,10 +15,8 @@ declare module 'v8' {
|
|
|
8
15
|
space_available_size: number;
|
|
9
16
|
physical_space_size: number;
|
|
10
17
|
}
|
|
11
|
-
|
|
12
18
|
// ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */
|
|
13
19
|
type DoesZapCodeSpaceFlag = 0 | 1;
|
|
14
|
-
|
|
15
20
|
interface HeapInfo {
|
|
16
21
|
total_heap_size: number;
|
|
17
22
|
total_heap_size_executable: number;
|
|
@@ -25,178 +30,349 @@ declare module 'v8' {
|
|
|
25
30
|
number_of_native_contexts: number;
|
|
26
31
|
number_of_detached_contexts: number;
|
|
27
32
|
}
|
|
28
|
-
|
|
29
33
|
interface HeapCodeStatistics {
|
|
30
34
|
code_and_metadata_size: number;
|
|
31
35
|
bytecode_and_metadata_size: number;
|
|
32
36
|
external_script_source_size: number;
|
|
33
37
|
}
|
|
34
|
-
|
|
35
38
|
/**
|
|
36
|
-
* Returns an integer representing a
|
|
37
|
-
*
|
|
39
|
+
* Returns an integer representing a version tag derived from the V8 version,
|
|
40
|
+
* command-line flags, and detected CPU features. This is useful for determining
|
|
41
|
+
* whether a `vm.Script` `cachedData` buffer is compatible with this instance
|
|
42
|
+
* of V8.
|
|
43
|
+
*
|
|
44
|
+
* ```js
|
|
45
|
+
* console.log(v8.cachedDataVersionTag()); // 3947234607
|
|
46
|
+
* // The value returned by v8.cachedDataVersionTag() is derived from the V8
|
|
47
|
+
* // version, command-line flags, and detected CPU features. Test that the value
|
|
48
|
+
* // does indeed update when flags are toggled.
|
|
49
|
+
* v8.setFlagsFromString('--allow_natives_syntax');
|
|
50
|
+
* console.log(v8.cachedDataVersionTag()); // 183726201
|
|
51
|
+
* ```
|
|
52
|
+
* @since v8.0.0
|
|
38
53
|
*/
|
|
39
54
|
function cachedDataVersionTag(): number;
|
|
40
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Returns an object with the following properties:
|
|
57
|
+
*
|
|
58
|
+
* `does_zap_garbage` is a 0/1 boolean, which signifies whether the`--zap_code_space` option is enabled or not. This makes V8 overwrite heap
|
|
59
|
+
* garbage with a bit pattern. The RSS footprint (resident set size) gets bigger
|
|
60
|
+
* because it continuously touches all heap pages and that makes them less likely
|
|
61
|
+
* to get swapped out by the operating system.
|
|
62
|
+
*
|
|
63
|
+
* `number_of_native_contexts` The value of native\_context is the number of the
|
|
64
|
+
* top-level contexts currently active. Increase of this number over time indicates
|
|
65
|
+
* a memory leak.
|
|
66
|
+
*
|
|
67
|
+
* `number_of_detached_contexts` The value of detached\_context is the number
|
|
68
|
+
* of contexts that were detached and not yet garbage collected. This number
|
|
69
|
+
* being non-zero indicates a potential memory leak.
|
|
70
|
+
*
|
|
71
|
+
* ```js
|
|
72
|
+
* {
|
|
73
|
+
* total_heap_size: 7326976,
|
|
74
|
+
* total_heap_size_executable: 4194304,
|
|
75
|
+
* total_physical_size: 7326976,
|
|
76
|
+
* total_available_size: 1152656,
|
|
77
|
+
* used_heap_size: 3476208,
|
|
78
|
+
* heap_size_limit: 1535115264,
|
|
79
|
+
* malloced_memory: 16384,
|
|
80
|
+
* peak_malloced_memory: 1127496,
|
|
81
|
+
* does_zap_garbage: 0,
|
|
82
|
+
* number_of_native_contexts: 1,
|
|
83
|
+
* number_of_detached_contexts: 0
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
* @since v1.0.0
|
|
87
|
+
*/
|
|
41
88
|
function getHeapStatistics(): HeapInfo;
|
|
89
|
+
/**
|
|
90
|
+
* Returns statistics about the V8 heap spaces, i.e. the segments which make up
|
|
91
|
+
* the V8 heap. Neither the ordering of heap spaces, nor the availability of a
|
|
92
|
+
* heap space can be guaranteed as the statistics are provided via the
|
|
93
|
+
* V8[`GetHeapSpaceStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4) function and may change from one V8 version to the
|
|
94
|
+
* next.
|
|
95
|
+
*
|
|
96
|
+
* The value returned is an array of objects containing the following properties:
|
|
97
|
+
*
|
|
98
|
+
* ```json
|
|
99
|
+
* [
|
|
100
|
+
* {
|
|
101
|
+
* "space_name": "new_space",
|
|
102
|
+
* "space_size": 2063872,
|
|
103
|
+
* "space_used_size": 951112,
|
|
104
|
+
* "space_available_size": 80824,
|
|
105
|
+
* "physical_space_size": 2063872
|
|
106
|
+
* },
|
|
107
|
+
* {
|
|
108
|
+
* "space_name": "old_space",
|
|
109
|
+
* "space_size": 3090560,
|
|
110
|
+
* "space_used_size": 2493792,
|
|
111
|
+
* "space_available_size": 0,
|
|
112
|
+
* "physical_space_size": 3090560
|
|
113
|
+
* },
|
|
114
|
+
* {
|
|
115
|
+
* "space_name": "code_space",
|
|
116
|
+
* "space_size": 1260160,
|
|
117
|
+
* "space_used_size": 644256,
|
|
118
|
+
* "space_available_size": 960,
|
|
119
|
+
* "physical_space_size": 1260160
|
|
120
|
+
* },
|
|
121
|
+
* {
|
|
122
|
+
* "space_name": "map_space",
|
|
123
|
+
* "space_size": 1094160,
|
|
124
|
+
* "space_used_size": 201608,
|
|
125
|
+
* "space_available_size": 0,
|
|
126
|
+
* "physical_space_size": 1094160
|
|
127
|
+
* },
|
|
128
|
+
* {
|
|
129
|
+
* "space_name": "large_object_space",
|
|
130
|
+
* "space_size": 0,
|
|
131
|
+
* "space_used_size": 0,
|
|
132
|
+
* "space_available_size": 1490980608,
|
|
133
|
+
* "physical_space_size": 0
|
|
134
|
+
* }
|
|
135
|
+
* ]
|
|
136
|
+
* ```
|
|
137
|
+
* @since v6.0.0
|
|
138
|
+
*/
|
|
42
139
|
function getHeapSpaceStatistics(): HeapSpaceInfo[];
|
|
140
|
+
/**
|
|
141
|
+
* The `v8.setFlagsFromString()` method can be used to programmatically set
|
|
142
|
+
* V8 command-line flags. This method should be used with care. Changing settings
|
|
143
|
+
* after the VM has started may result in unpredictable behavior, including
|
|
144
|
+
* crashes and data loss; or it may simply do nothing.
|
|
145
|
+
*
|
|
146
|
+
* The V8 options available for a version of Node.js may be determined by running`node --v8-options`.
|
|
147
|
+
*
|
|
148
|
+
* Usage:
|
|
149
|
+
*
|
|
150
|
+
* ```js
|
|
151
|
+
* // Print GC events to stdout for one minute.
|
|
152
|
+
* const v8 = require('v8');
|
|
153
|
+
* v8.setFlagsFromString('--trace_gc');
|
|
154
|
+
* setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
|
|
155
|
+
* ```
|
|
156
|
+
* @since v1.0.0
|
|
157
|
+
*/
|
|
43
158
|
function setFlagsFromString(flags: string): void;
|
|
44
159
|
/**
|
|
45
160
|
* Generates a snapshot of the current V8 heap and returns a Readable
|
|
46
161
|
* Stream that may be used to read the JSON serialized representation.
|
|
47
|
-
* This conversation was marked as resolved by joyeecheung
|
|
48
162
|
* This JSON stream format is intended to be used with tools such as
|
|
49
163
|
* Chrome DevTools. The JSON schema is undocumented and specific to the
|
|
50
|
-
* V8 engine,
|
|
164
|
+
* V8 engine. Therefore, the schema may change from one version of V8 to the next.
|
|
165
|
+
*
|
|
166
|
+
* ```js
|
|
167
|
+
* // Print heap snapshot to the console
|
|
168
|
+
* const v8 = require('v8');
|
|
169
|
+
* const stream = v8.getHeapSnapshot();
|
|
170
|
+
* stream.pipe(process.stdout);
|
|
171
|
+
* ```
|
|
172
|
+
* @since v11.13.0
|
|
173
|
+
* @return A Readable Stream containing the V8 heap snapshot
|
|
51
174
|
*/
|
|
52
175
|
function getHeapSnapshot(): Readable;
|
|
53
|
-
|
|
54
176
|
/**
|
|
177
|
+
* Generates a snapshot of the current V8 heap and writes it to a JSON
|
|
178
|
+
* file. This file is intended to be used with tools such as Chrome
|
|
179
|
+
* DevTools. The JSON schema is undocumented and specific to the V8
|
|
180
|
+
* engine, and may change from one version of V8 to the next.
|
|
181
|
+
*
|
|
182
|
+
* A heap snapshot is specific to a single V8 isolate. When using `worker threads`, a heap snapshot generated from the main thread will
|
|
183
|
+
* not contain any information about the workers, and vice versa.
|
|
184
|
+
*
|
|
185
|
+
* ```js
|
|
186
|
+
* const { writeHeapSnapshot } = require('v8');
|
|
187
|
+
* const {
|
|
188
|
+
* Worker,
|
|
189
|
+
* isMainThread,
|
|
190
|
+
* parentPort
|
|
191
|
+
* } = require('worker_threads');
|
|
192
|
+
*
|
|
193
|
+
* if (isMainThread) {
|
|
194
|
+
* const worker = new Worker(__filename);
|
|
195
|
+
*
|
|
196
|
+
* worker.once('message', (filename) => {
|
|
197
|
+
* console.log(`worker heapdump: ${filename}`);
|
|
198
|
+
* // Now get a heapdump for the main thread.
|
|
199
|
+
* console.log(`main thread heapdump: ${writeHeapSnapshot()}`);
|
|
200
|
+
* });
|
|
201
|
+
*
|
|
202
|
+
* // Tell the worker to create a heapdump.
|
|
203
|
+
* worker.postMessage('heapdump');
|
|
204
|
+
* } else {
|
|
205
|
+
* parentPort.once('message', (message) => {
|
|
206
|
+
* if (message === 'heapdump') {
|
|
207
|
+
* // Generate a heapdump for the worker
|
|
208
|
+
* // and return the filename to the parent.
|
|
209
|
+
* parentPort.postMessage(writeHeapSnapshot());
|
|
210
|
+
* }
|
|
211
|
+
* });
|
|
212
|
+
* }
|
|
213
|
+
* ```
|
|
214
|
+
* @since v11.13.0
|
|
215
|
+
* @param filename The file path where the V8 heap snapshot is to be saved. If not specified, a file name with the pattern `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be
|
|
216
|
+
* generated, where `{pid}` will be the PID of the Node.js process, `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from the main Node.js thread or the id of a
|
|
217
|
+
* worker thread.
|
|
218
|
+
* @return The filename where the snapshot was saved.
|
|
219
|
+
*/
|
|
220
|
+
function writeHeapSnapshot(filename?: string): string;
|
|
221
|
+
/**
|
|
222
|
+
* Returns an object with the following properties:
|
|
55
223
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
224
|
+
* ```js
|
|
225
|
+
* {
|
|
226
|
+
* code_and_metadata_size: 212208,
|
|
227
|
+
* bytecode_and_metadata_size: 161368,
|
|
228
|
+
* external_script_source_size: 1410794
|
|
229
|
+
* }
|
|
230
|
+
* ```
|
|
231
|
+
* @since v12.8.0
|
|
62
232
|
*/
|
|
63
|
-
function writeHeapSnapshot(fileName?: string): string;
|
|
64
|
-
|
|
65
233
|
function getHeapCodeStatistics(): HeapCodeStatistics;
|
|
66
|
-
|
|
234
|
+
/**
|
|
235
|
+
* @since v8.0.0
|
|
236
|
+
*/
|
|
67
237
|
class Serializer {
|
|
68
238
|
/**
|
|
69
239
|
* Writes out a header, which includes the serialization format version.
|
|
70
240
|
*/
|
|
71
241
|
writeHeader(): void;
|
|
72
|
-
|
|
73
242
|
/**
|
|
74
|
-
* Serializes a JavaScript value and adds the serialized representation to the
|
|
75
|
-
*
|
|
243
|
+
* Serializes a JavaScript value and adds the serialized representation to the
|
|
244
|
+
* internal buffer.
|
|
245
|
+
*
|
|
246
|
+
* This throws an error if `value` cannot be serialized.
|
|
76
247
|
*/
|
|
77
248
|
writeValue(val: any): boolean;
|
|
78
|
-
|
|
79
249
|
/**
|
|
80
|
-
* Returns the stored internal buffer.
|
|
81
|
-
*
|
|
82
|
-
*
|
|
250
|
+
* Returns the stored internal buffer. This serializer should not be used once
|
|
251
|
+
* the buffer is released. Calling this method results in undefined behavior
|
|
252
|
+
* if a previous write has failed.
|
|
83
253
|
*/
|
|
84
254
|
releaseBuffer(): Buffer;
|
|
85
|
-
|
|
86
255
|
/**
|
|
87
|
-
* Marks an ArrayBuffer as having its contents transferred out of band
|
|
88
|
-
* Pass the corresponding ArrayBuffer in the deserializing context to deserializer.transferArrayBuffer()
|
|
256
|
+
* Marks an `ArrayBuffer` as having its contents transferred out of band.
|
|
257
|
+
* Pass the corresponding `ArrayBuffer` in the deserializing context to `deserializer.transferArrayBuffer()`.
|
|
258
|
+
* @param id A 32-bit unsigned integer.
|
|
259
|
+
* @param arrayBuffer An `ArrayBuffer` instance.
|
|
89
260
|
*/
|
|
90
261
|
transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void;
|
|
91
|
-
|
|
92
262
|
/**
|
|
93
263
|
* Write a raw 32-bit unsigned integer.
|
|
264
|
+
* For use inside of a custom `serializer._writeHostObject()`.
|
|
94
265
|
*/
|
|
95
266
|
writeUint32(value: number): void;
|
|
96
|
-
|
|
97
267
|
/**
|
|
98
268
|
* Write a raw 64-bit unsigned integer, split into high and low 32-bit parts.
|
|
269
|
+
* For use inside of a custom `serializer._writeHostObject()`.
|
|
99
270
|
*/
|
|
100
271
|
writeUint64(hi: number, lo: number): void;
|
|
101
|
-
|
|
102
272
|
/**
|
|
103
|
-
* Write a JS number value.
|
|
273
|
+
* Write a JS `number` value.
|
|
274
|
+
* For use inside of a custom `serializer._writeHostObject()`.
|
|
104
275
|
*/
|
|
105
276
|
writeDouble(value: number): void;
|
|
106
|
-
|
|
107
277
|
/**
|
|
108
|
-
* Write raw bytes into the serializer’s internal buffer.
|
|
109
|
-
*
|
|
278
|
+
* Write raw bytes into the serializer’s internal buffer. The deserializer
|
|
279
|
+
* will require a way to compute the length of the buffer.
|
|
280
|
+
* For use inside of a custom `serializer._writeHostObject()`.
|
|
110
281
|
*/
|
|
111
282
|
writeRawBytes(buffer: NodeJS.TypedArray): void;
|
|
112
283
|
}
|
|
113
|
-
|
|
114
284
|
/**
|
|
115
|
-
* A subclass of `Serializer` that serializes `TypedArray`
|
|
116
|
-
*
|
|
285
|
+
* A subclass of `Serializer` that serializes `TypedArray`(in particular `Buffer`) and `DataView` objects as host objects, and only
|
|
286
|
+
* stores the part of their underlying `ArrayBuffer`s that they are referring to.
|
|
287
|
+
* @since v8.0.0
|
|
288
|
+
*/
|
|
289
|
+
class DefaultSerializer extends Serializer {}
|
|
290
|
+
/**
|
|
291
|
+
* @since v8.0.0
|
|
117
292
|
*/
|
|
118
|
-
class DefaultSerializer extends Serializer {
|
|
119
|
-
}
|
|
120
|
-
|
|
121
293
|
class Deserializer {
|
|
122
294
|
constructor(data: NodeJS.TypedArray);
|
|
123
295
|
/**
|
|
124
296
|
* Reads and validates a header (including the format version).
|
|
125
|
-
* May, for example, reject an invalid or unsupported wire format.
|
|
126
|
-
*
|
|
297
|
+
* May, for example, reject an invalid or unsupported wire format. In that case,
|
|
298
|
+
* an `Error` is thrown.
|
|
127
299
|
*/
|
|
128
300
|
readHeader(): boolean;
|
|
129
|
-
|
|
130
301
|
/**
|
|
131
302
|
* Deserializes a JavaScript value from the buffer and returns it.
|
|
132
303
|
*/
|
|
133
304
|
readValue(): any;
|
|
134
|
-
|
|
135
305
|
/**
|
|
136
|
-
* Marks an ArrayBuffer as having its contents transferred out of band.
|
|
137
|
-
* Pass the corresponding `ArrayBuffer` in the serializing context to serializer.transferArrayBuffer()
|
|
138
|
-
*
|
|
306
|
+
* Marks an `ArrayBuffer` as having its contents transferred out of band.
|
|
307
|
+
* Pass the corresponding `ArrayBuffer` in the serializing context to `serializer.transferArrayBuffer()` (or return the `id` from `serializer._getSharedArrayBufferId()` in the case of
|
|
308
|
+
* `SharedArrayBuffer`s).
|
|
309
|
+
* @param id A 32-bit unsigned integer.
|
|
310
|
+
* @param arrayBuffer An `ArrayBuffer` instance.
|
|
139
311
|
*/
|
|
140
312
|
transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void;
|
|
141
|
-
|
|
142
313
|
/**
|
|
143
|
-
* Reads the underlying wire format version.
|
|
144
|
-
*
|
|
145
|
-
* May not be called before .readHeader().
|
|
314
|
+
* Reads the underlying wire format version. Likely mostly to be useful to
|
|
315
|
+
* legacy code reading old wire format versions. May not be called before`.readHeader()`.
|
|
146
316
|
*/
|
|
147
317
|
getWireFormatVersion(): number;
|
|
148
|
-
|
|
149
318
|
/**
|
|
150
319
|
* Read a raw 32-bit unsigned integer and return it.
|
|
320
|
+
* For use inside of a custom `deserializer._readHostObject()`.
|
|
151
321
|
*/
|
|
152
322
|
readUint32(): number;
|
|
153
|
-
|
|
154
323
|
/**
|
|
155
|
-
* Read a raw 64-bit unsigned integer and return it as an array [hi, lo]
|
|
324
|
+
* Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]`with two 32-bit unsigned integer entries.
|
|
325
|
+
* For use inside of a custom `deserializer._readHostObject()`.
|
|
156
326
|
*/
|
|
157
327
|
readUint64(): [number, number];
|
|
158
|
-
|
|
159
328
|
/**
|
|
160
|
-
* Read a JS number value.
|
|
329
|
+
* Read a JS `number` value.
|
|
330
|
+
* For use inside of a custom `deserializer._readHostObject()`.
|
|
161
331
|
*/
|
|
162
332
|
readDouble(): number;
|
|
163
|
-
|
|
164
333
|
/**
|
|
165
|
-
* Read raw bytes from the deserializer’s internal buffer.
|
|
166
|
-
*
|
|
334
|
+
* Read raw bytes from the deserializer’s internal buffer. The `length` parameter
|
|
335
|
+
* must correspond to the length of the buffer that was passed to `serializer.writeRawBytes()`.
|
|
336
|
+
* For use inside of a custom `deserializer._readHostObject()`.
|
|
167
337
|
*/
|
|
168
338
|
readRawBytes(length: number): Buffer;
|
|
169
339
|
}
|
|
170
|
-
|
|
171
340
|
/**
|
|
172
|
-
* A subclass of `
|
|
173
|
-
*
|
|
341
|
+
* A subclass of `Deserializer` corresponding to the format written by `DefaultSerializer`.
|
|
342
|
+
* @since v8.0.0
|
|
174
343
|
*/
|
|
175
|
-
class DefaultDeserializer extends Deserializer {
|
|
176
|
-
}
|
|
177
|
-
|
|
344
|
+
class DefaultDeserializer extends Deserializer {}
|
|
178
345
|
/**
|
|
179
|
-
* Uses a `DefaultSerializer` to serialize value into a buffer.
|
|
346
|
+
* Uses a `DefaultSerializer` to serialize `value` into a buffer.
|
|
347
|
+
* @since v8.0.0
|
|
180
348
|
*/
|
|
181
349
|
function serialize(value: any): Buffer;
|
|
182
|
-
|
|
183
350
|
/**
|
|
184
|
-
* Uses a `DefaultDeserializer` with default options to read a JS value
|
|
351
|
+
* Uses a `DefaultDeserializer` with default options to read a JS value
|
|
352
|
+
* from a buffer.
|
|
353
|
+
* @since v8.0.0
|
|
354
|
+
* @param buffer A buffer returned by {@link serialize}.
|
|
185
355
|
*/
|
|
186
|
-
function deserialize(
|
|
187
|
-
|
|
356
|
+
function deserialize(buffer: NodeJS.TypedArray): any;
|
|
188
357
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
358
|
+
* The `v8.takeCoverage()` method allows the user to write the coverage started by `NODE_V8_COVERAGE` to disk on demand. This method can be invoked multiple
|
|
359
|
+
* times during the lifetime of the process. Each time the execution counter will
|
|
360
|
+
* be reset and a new coverage report will be written to the directory specified
|
|
361
|
+
* by `NODE_V8_COVERAGE`.
|
|
362
|
+
*
|
|
363
|
+
* When the process is about to exit, one last coverage will still be written to
|
|
364
|
+
* disk unless {@link stopCoverage} is invoked before the process exits.
|
|
365
|
+
* @since v15.1.0, v12.22.0
|
|
191
366
|
*/
|
|
192
367
|
function takeCoverage(): void;
|
|
193
|
-
|
|
194
368
|
/**
|
|
195
|
-
*
|
|
369
|
+
* The `v8.stopCoverage()` method allows the user to stop the coverage collection
|
|
370
|
+
* started by `NODE_V8_COVERAGE`, so that V8 can release the execution count
|
|
371
|
+
* records and optimize code. This can be used in conjunction with {@link takeCoverage} if the user wants to collect the coverage on demand.
|
|
372
|
+
* @since v15.1.0, v12.22.0
|
|
196
373
|
*/
|
|
197
374
|
function stopCoverage(): void;
|
|
198
375
|
}
|
|
199
|
-
|
|
200
376
|
declare module 'node:v8' {
|
|
201
377
|
export * from 'v8';
|
|
202
378
|
}
|