/usr/share/doc/nodejs-docs/doc/api
{ "type": "module", "source": "doc/api/v8.md", "modules": [ { "textRaw": "V8", "name": "v8", "introduced_in": "v4.0.0", "desc": "<p><strong>Source Code:</strong> <a href=\"https://github.com/nodejs/node/blob/v16.20.2/lib/v8.js\">lib/v8.js</a></p>\n<p>The <code>node:v8</code> module exposes APIs that are specific to the version of <a href=\"https://developers.google.com/v8/\">V8</a>\nbuilt into the Node.js binary. It can be accessed using:</p>\n<pre><code class=\"language-js\">const v8 = require('node:v8');\n</code></pre>", "methods": [ { "textRaw": "`v8.cachedDataVersionTag()`", "type": "method", "name": "cachedDataVersionTag", "meta": { "added": [ "v8.0.0" ], "changes": [] }, "signatures": [ { "return": { "textRaw": "Returns: {integer}", "name": "return", "type": "integer" }, "params": [] } ], "desc": "<p>Returns an integer representing a version tag derived from the V8 version,\ncommand-line flags, and detected CPU features. This is useful for determining\nwhether a <a href=\"vm.html#new-vmscriptcode-options\"><code>vm.Script</code></a> <code>cachedData</code> buffer is compatible with this instance\nof V8.</p>\n<pre><code class=\"language-js\">console.log(v8.cachedDataVersionTag()); // 3947234607\n// The value returned by v8.cachedDataVersionTag() is derived from the V8\n// version, command-line flags, and detected CPU features. Test that the value\n// does indeed update when flags are toggled.\nv8.setFlagsFromString('--allow_natives_syntax');\nconsole.log(v8.cachedDataVersionTag()); // 183726201\n</code></pre>" }, { "textRaw": "`v8.getHeapCodeStatistics()`", "type": "method", "name": "getHeapCodeStatistics", "meta": { "added": [ "v12.8.0" ], "changes": [] }, "signatures": [ { "return": { "textRaw": "Returns: {Object}", "name": "return", "type": "Object" }, "params": [] } ], "desc": "<p>Returns an object with the following properties:</p>\n<ul>\n<li><code>code_and_metadata_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>bytecode_and_metadata_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>external_script_source_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n</ul>\n<!-- eslint-skip -->\n<pre><code class=\"language-js\">{\n code_and_metadata_size: 212208,\n bytecode_and_metadata_size: 161368,\n external_script_source_size: 1410794\n}\n</code></pre>" }, { "textRaw": "`v8.getHeapSnapshot()`", "type": "method", "name": "getHeapSnapshot", "meta": { "added": [ "v11.13.0" ], "changes": [] }, "signatures": [ { "return": { "textRaw": "Returns: {stream.Readable} A Readable Stream containing the V8 heap snapshot", "name": "return", "type": "stream.Readable", "desc": "A Readable Stream containing the V8 heap snapshot" }, "params": [] } ], "desc": "<p>Generates a snapshot of the current V8 heap and returns a Readable\nStream that may be used to read the JSON serialized representation.\nThis JSON stream format is intended to be used with tools such as\nChrome DevTools. The JSON schema is undocumented and specific to the\nV8 engine. Therefore, the schema may change from one version of V8 to the next.</p>\n<p>Creating a heap snapshot requires memory about twice the size of the heap at\nthe time the snapshot is created. This results in the risk of OOM killers\nterminating the process.</p>\n<p>Generating a snapshot is a synchronous operation which blocks the event loop\nfor a duration depending on the heap size.</p>\n<pre><code class=\"language-js\">// Print heap snapshot to the console\nconst v8 = require('node:v8');\nconst stream = v8.getHeapSnapshot();\nstream.pipe(process.stdout);\n</code></pre>" }, { "textRaw": "`v8.getHeapSpaceStatistics()`", "type": "method", "name": "getHeapSpaceStatistics", "meta": { "added": [ "v6.0.0" ], "changes": [ { "version": "v7.5.0", "pr-url": "https://github.com/nodejs/node/pull/10186", "description": "Support values exceeding the 32-bit unsigned integer range." } ] }, "signatures": [ { "return": { "textRaw": "Returns: {Object\\[]}", "name": "return", "type": "Object\\[]" }, "params": [] } ], "desc": "<p>Returns statistics about the V8 heap spaces, i.e. the segments which make up\nthe V8 heap. Neither the ordering of heap spaces, nor the availability of a\nheap space can be guaranteed as the statistics are provided via the V8\n<a href=\"https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4\"><code>GetHeapSpaceStatistics</code></a> function and may change from one V8 version to the\nnext.</p>\n<p>The value returned is an array of objects containing the following properties:</p>\n<ul>\n<li><code>space_name</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type\" class=\"type\"><string></a></li>\n<li><code>space_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>space_used_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>space_available_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>physical_space_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n</ul>\n<pre><code class=\"language-json\">[\n {\n \"space_name\": \"new_space\",\n \"space_size\": 2063872,\n \"space_used_size\": 951112,\n \"space_available_size\": 80824,\n \"physical_space_size\": 2063872\n },\n {\n \"space_name\": \"old_space\",\n \"space_size\": 3090560,\n \"space_used_size\": 2493792,\n \"space_available_size\": 0,\n \"physical_space_size\": 3090560\n },\n {\n \"space_name\": \"code_space\",\n \"space_size\": 1260160,\n \"space_used_size\": 644256,\n \"space_available_size\": 960,\n \"physical_space_size\": 1260160\n },\n {\n \"space_name\": \"map_space\",\n \"space_size\": 1094160,\n \"space_used_size\": 201608,\n \"space_available_size\": 0,\n \"physical_space_size\": 1094160\n },\n {\n \"space_name\": \"large_object_space\",\n \"space_size\": 0,\n \"space_used_size\": 0,\n \"space_available_size\": 1490980608,\n \"physical_space_size\": 0\n }\n]\n</code></pre>" }, { "textRaw": "`v8.getHeapStatistics()`", "type": "method", "name": "getHeapStatistics", "meta": { "added": [ "v1.0.0" ], "changes": [ { "version": "v7.5.0", "pr-url": "https://github.com/nodejs/node/pull/10186", "description": "Support values exceeding the 32-bit unsigned integer range." }, { "version": "v7.2.0", "pr-url": "https://github.com/nodejs/node/pull/8610", "description": "Added `malloced_memory`, `peak_malloced_memory`, and `does_zap_garbage`." } ] }, "signatures": [ { "return": { "textRaw": "Returns: {Object}", "name": "return", "type": "Object" }, "params": [] } ], "desc": "<p>Returns an object with the following properties:</p>\n<ul>\n<li><code>total_heap_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>total_heap_size_executable</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>total_physical_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>total_available_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>used_heap_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>heap_size_limit</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>malloced_memory</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>peak_malloced_memory</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>does_zap_garbage</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>number_of_native_contexts</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>number_of_detached_contexts</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>total_global_handles_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>used_global_handles_size</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n<li><code>external_memory</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type\" class=\"type\"><number></a></li>\n</ul>\n<p><code>does_zap_garbage</code> is a 0/1 boolean, which signifies whether the\n<code>--zap_code_space</code> option is enabled or not. This makes V8 overwrite heap\ngarbage with a bit pattern. The RSS footprint (resident set size) gets bigger\nbecause it continuously touches all heap pages and that makes them less likely\nto get swapped out by the operating system.</p>\n<p><code>number_of_native_contexts</code> The value of native_context is the number of the\ntop-level contexts currently active. Increase of this number over time indicates\na memory leak.</p>\n<p><code>number_of_detached_contexts</code> The value of detached_context is the number\nof contexts that were detached and not yet garbage collected. This number\nbeing non-zero indicates a potential memory leak.</p>\n<p><code>total_global_handles_size</code> The value of total_global_handles_size is the\ntotal memory size of V8 global handles.</p>\n<p><code>used_global_handles_size</code> The value of used_global_handles_size is the\nused memory size of V8 global handles.</p>\n<p><code>external_memory</code> The value of external_memory is the memory size of array\nbuffers and external strings.</p>\n<!-- eslint-skip -->\n<pre><code class=\"language-js\">{\n total_heap_size: 7326976,\n total_heap_size_executable: 4194304,\n total_physical_size: 7326976,\n total_available_size: 1152656,\n used_heap_size: 3476208,\n heap_size_limit: 1535115264,\n malloced_memory: 16384,\n peak_malloced_memory: 1127496,\n does_zap_garbage: 0,\n number_of_native_contexts: 1,\n number_of_detached_contexts: 0,\n total_global_handles_size: 8192,\n used_global_handles_size: 3296,\n external_memory: 318824\n}\n</code></pre>" }, { "textRaw": "`v8.setFlagsFromString(flags)`", "type": "method", "name": "setFlagsFromString", "meta": { "added": [ "v1.0.0" ], "changes": [] }, "signatures": [ { "params": [ { "textRaw": "`flags` {string}", "name": "flags", "type": "string" } ] } ], "desc": "<p>The <code>v8.setFlagsFromString()</code> method can be used to programmatically set\nV8 command-line flags. This method should be used with care. Changing settings\nafter the VM has started may result in unpredictable behavior, including\ncrashes and data loss; or it may simply do nothing.</p>\n<p>The V8 options available for a version of Node.js may be determined by running\n<code>node --v8-options</code>.</p>\n<p>Usage:</p>\n<pre><code class=\"language-js\">// Print GC events to stdout for one minute.\nconst v8 = require('node:v8');\nv8.setFlagsFromString('--trace_gc');\nsetTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);\n</code></pre>" }, { "textRaw": "`v8.stopCoverage()`", "type": "method", "name": "stopCoverage", "meta": { "added": [ "v15.1.0", "v12.22.0" ], "changes": [] }, "signatures": [ { "params": [] } ], "desc": "<p>The <code>v8.stopCoverage()</code> method allows the user to stop the coverage collection\nstarted by <a href=\"cli.html#node_v8_coveragedir\"><code>NODE_V8_COVERAGE</code></a>, so that V8 can release the execution count\nrecords and optimize code. This can be used in conjunction with\n<a href=\"#v8takecoverage\"><code>v8.takeCoverage()</code></a> if the user wants to collect the coverage on demand.</p>" }, { "textRaw": "`v8.takeCoverage()`", "type": "method", "name": "takeCoverage", "meta": { "added": [ "v15.1.0", "v12.22.0" ], "changes": [] }, "signatures": [ { "params": [] } ], "desc": "<p>The <code>v8.takeCoverage()</code> method allows the user to write the coverage started by\n<a href=\"cli.html#node_v8_coveragedir\"><code>NODE_V8_COVERAGE</code></a> to disk on demand. This method can be invoked multiple\ntimes during the lifetime of the process. Each time the execution counter will\nbe reset and a new coverage report will be written to the directory specified\nby <a href=\"cli.html#node_v8_coveragedir\"><code>NODE_V8_COVERAGE</code></a>.</p>\n<p>When the process is about to exit, one last coverage will still be written to\ndisk unless <a href=\"#v8stopcoverage\"><code>v8.stopCoverage()</code></a> is invoked before the process exits.</p>" }, { "textRaw": "`v8.writeHeapSnapshot([filename])`", "type": "method", "name": "writeHeapSnapshot", "meta": { "added": [ "v11.13.0" ], "changes": [] }, "signatures": [ { "return": { "textRaw": "Returns: {string} The filename where the snapshot was saved.", "name": "return", "type": "string", "desc": "The filename where the snapshot was saved." }, "params": [ { "textRaw": "`filename` {string} 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 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 worker thread.", "name": "filename", "type": "string", "desc": "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 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 worker thread." } ] } ], "desc": "<p>Generates a snapshot of the current V8 heap and writes it to a JSON\nfile. This file is intended to be used with tools such as Chrome\nDevTools. The JSON schema is undocumented and specific to the V8\nengine, and may change from one version of V8 to the next.</p>\n<p>A heap snapshot is specific to a single V8 isolate. When using\n<a href=\"worker_threads.html\">worker threads</a>, a heap snapshot generated from the main thread will\nnot contain any information about the workers, and vice versa.</p>\n<p>Creating a heap snapshot requires memory about twice the size of the heap at\nthe time the snapshot is created. This results in the risk of OOM killers\nterminating the process.</p>\n<p>Generating a snapshot is a synchronous operation which blocks the event loop\nfor a duration depending on the heap size.</p>\n<pre><code class=\"language-js\">const { writeHeapSnapshot } = require('node:v8');\nconst {\n Worker,\n isMainThread,\n parentPort\n} = require('node:worker_threads');\n\nif (isMainThread) {\n const worker = new Worker(__filename);\n\n worker.once('message', (filename) => {\n console.log(`worker heapdump: ${filename}`);\n // Now get a heapdump for the main thread.\n console.log(`main thread heapdump: ${writeHeapSnapshot()}`);\n });\n\n // Tell the worker to create a heapdump.\n worker.postMessage('heapdump');\n} else {\n parentPort.once('message', (message) => {\n if (message === 'heapdump') {\n // Generate a heapdump for the worker\n // and return the filename to the parent.\n parentPort.postMessage(writeHeapSnapshot());\n }\n });\n}\n</code></pre>" }, { "textRaw": "`v8.setHeapSnapshotNearHeapLimit(limit)`", "type": "method", "name": "setHeapSnapshotNearHeapLimit", "meta": { "added": [ "v16.18.0" ], "changes": [] }, "stability": 1, "stabilityText": "Experimental", "signatures": [ { "params": [ { "textRaw": "`limit` {integer}", "name": "limit", "type": "integer" } ] } ], "desc": "<p>The API is a no-op if <code>--heapsnapshot-near-heap-limit</code> is already set from the\ncommand line or the API is called more than once. <code>limit</code> must be a positive\ninteger. See <a href=\"cli.html#--heapsnapshot-near-heap-limitmax_count\"><code>--heapsnapshot-near-heap-limit</code></a> for more information.</p>" } ], "modules": [ { "textRaw": "Serialization API", "name": "serialization_api", "desc": "<p>The serialization API provides means of serializing JavaScript values in a way\nthat is compatible with the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\">HTML structured clone algorithm</a>.</p>\n<p>The format is backward-compatible (i.e. safe to store to disk).\nEqual JavaScript values may result in different serialized output.</p>", "methods": [ { "textRaw": "`v8.serialize(value)`", "type": "method", "name": "serialize", "meta": { "added": [ "v8.0.0" ], "changes": [] }, "signatures": [ { "return": { "textRaw": "Returns: {Buffer}", "name": "return", "type": "Buffer" }, "params": [ { "textRaw": "`value` {any}", "name": "value", "type": "any" } ] } ], "desc": "<p>Uses a <a href=\"#class-v8defaultserializer\"><code>DefaultSerializer</code></a> to serialize <code>value</code> into a buffer.</p>\n<p><a href=\"errors.html#err_buffer_too_large\"><code>ERR_BUFFER_TOO_LARGE</code></a> will be thrown when trying to\nserialize a huge object which requires buffer\nlarger than <a href=\"buffer.html#bufferconstantsmax_length\"><code>buffer.constants.MAX_LENGTH</code></a>.</p>" }, { "textRaw": "`v8.deserialize(buffer)`", "type": "method", "name": "deserialize", "meta": { "added": [ "v8.0.0" ], "changes": [] }, "signatures": [ { "params": [ { "textRaw": "`buffer` {Buffer|TypedArray|DataView} A buffer returned by [`serialize()`][].", "name": "buffer", "type": "Buffer|TypedArray|DataView", "desc": "A buffer returned by [`serialize()`][]." } ] } ], "desc": "<p>Uses a <a href=\"#class-v8defaultdeserializer\"><code>DefaultDeserializer</code></a> with default options to read a JS value\nfrom a buffer.</p>" } ], "classes": [ { "textRaw": "Class: `v8.Serializer`", "type": "class", "name": "v8.Serializer", "meta": { "added": [ "v8.0.0" ], "changes": [] }, "methods": [ { "textRaw": "`serializer.writeHeader()`", "type": "method", "name": "writeHeader", "signatures": [ { "params": [] } ], "desc": "<p>Writes out a header, which includes the serialization format version.</p>" }, { "textRaw": "`serializer.writeValue(value)`", "type": "method", "name": "writeValue", "signatures": [ { "params": [ { "textRaw": "`value` {any}", "name": "value", "type": "any" } ] } ], "desc": "<p>Serializes a JavaScript value and adds the serialized representation to the\ninternal buffer.</p>\n<p>This throws an error if <code>value</code> cannot be serialized.</p>" }, { "textRaw": "`serializer.releaseBuffer()`", "type": "method", "name": "releaseBuffer", "signatures": [ { "return": { "textRaw": "Returns: {Buffer}", "name": "return", "type": "Buffer" }, "params": [] } ], "desc": "<p>Returns the stored internal buffer. This serializer should not be used once\nthe buffer is released. Calling this method results in undefined behavior\nif a previous write has failed.</p>" }, { "textRaw": "`serializer.transferArrayBuffer(id, arrayBuffer)`", "type": "method", "name": "transferArrayBuffer", "signatures": [ { "params": [ { "textRaw": "`id` {integer} A 32-bit unsigned integer.", "name": "id", "type": "integer", "desc": "A 32-bit unsigned integer." }, { "textRaw": "`arrayBuffer` {ArrayBuffer} An `ArrayBuffer` instance.", "name": "arrayBuffer", "type": "ArrayBuffer", "desc": "An `ArrayBuffer` instance." } ] } ], "desc": "<p>Marks an <code>ArrayBuffer</code> as having its contents transferred out of band.\nPass the corresponding <code>ArrayBuffer</code> in the deserializing context to\n<a href=\"#deserializertransferarraybufferid-arraybuffer\"><code>deserializer.transferArrayBuffer()</code></a>.</p>" }, { "textRaw": "`serializer.writeUint32(value)`", "type": "method", "name": "writeUint32", "signatures": [ { "params": [ { "textRaw": "`value` {integer}", "name": "value", "type": "integer" } ] } ], "desc": "<p>Write a raw 32-bit unsigned integer.\nFor use inside of a custom <a href=\"#serializer_writehostobjectobject\"><code>serializer._writeHostObject()</code></a>.</p>" }, { "textRaw": "`serializer.writeUint64(hi, lo)`", "type": "method", "name": "writeUint64", "signatures": [ { "params": [ { "textRaw": "`hi` {integer}", "name": "hi", "type": "integer" }, { "textRaw": "`lo` {integer}", "name": "lo", "type": "integer" } ] } ], "desc": "<p>Write a raw 64-bit unsigned integer, split into high and low 32-bit parts.\nFor use inside of a custom <a href=\"#serializer_writehostobjectobject\"><code>serializer._writeHostObject()</code></a>.</p>" }, { "textRaw": "`serializer.writeDouble(value)`", "type": "method", "name": "writeDouble", "signatures": [ { "params": [ { "textRaw": "`value` {number}", "name": "value", "type": "number" } ] } ], "desc": "<p>Write a JS <code>number</code> value.\nFor use inside of a custom <a href=\"#serializer_writehostobjectobject\"><code>serializer._writeHostObject()</code></a>.</p>" }, { "textRaw": "`serializer.writeRawBytes(buffer)`", "type": "method", "name": "writeRawBytes", "signatures": [ { "params": [ { "textRaw": "`buffer` {Buffer|TypedArray|DataView}", "name": "buffer", "type": "Buffer|TypedArray|DataView" } ] } ], "desc": "<p>Write raw bytes into the serializer's internal buffer. The deserializer\nwill require a way to compute the length of the buffer.\nFor use inside of a custom <a href=\"#serializer_writehostobjectobject\"><code>serializer._writeHostObject()</code></a>.</p>" }, { "textRaw": "`serializer._writeHostObject(object)`", "type": "method", "name": "_writeHostObject", "signatures": [ { "params": [ { "textRaw": "`object` {Object}", "name": "object", "type": "Object" } ] } ], "desc": "<p>This method is called to write some kind of host object, i.e. an object created\nby native C++ bindings. If it is not possible to serialize <code>object</code>, a suitable\nexception should be thrown.</p>\n<p>This method is not present on the <code>Serializer</code> class itself but can be provided\nby subclasses.</p>" }, { "textRaw": "`serializer._getDataCloneError(message)`", "type": "method", "name": "_getDataCloneError", "signatures": [ { "params": [ { "textRaw": "`message` {string}", "name": "message", "type": "string" } ] } ], "desc": "<p>This method is called to generate error objects that will be thrown when an\nobject can not be cloned.</p>\n<p>This method defaults to the <a href=\"errors.html#class-error\"><code>Error</code></a> constructor and can be overridden on\nsubclasses.</p>" }, { "textRaw": "`serializer._getSharedArrayBufferId(sharedArrayBuffer)`", "type": "method", "name": "_getSharedArrayBufferId", "signatures": [ { "params": [ { "textRaw": "`sharedArrayBuffer` {SharedArrayBuffer}", "name": "sharedArrayBuffer", "type": "SharedArrayBuffer" } ] } ], "desc": "<p>This method is called when the serializer is going to serialize a\n<code>SharedArrayBuffer</code> object. It must return an unsigned 32-bit integer ID for\nthe object, using the same ID if this <code>SharedArrayBuffer</code> has already been\nserialized. When deserializing, this ID will be passed to\n<a href=\"#deserializertransferarraybufferid-arraybuffer\"><code>deserializer.transferArrayBuffer()</code></a>.</p>\n<p>If the object cannot be serialized, an exception should be thrown.</p>\n<p>This method is not present on the <code>Serializer</code> class itself but can be provided\nby subclasses.</p>" }, { "textRaw": "`serializer._setTreatArrayBufferViewsAsHostObjects(flag)`", "type": "method", "name": "_setTreatArrayBufferViewsAsHostObjects", "signatures": [ { "params": [ { "textRaw": "`flag` {boolean} **Default:** `false`", "name": "flag", "type": "boolean", "default": "`false`" } ] } ], "desc": "<p>Indicate whether to treat <code>TypedArray</code> and <code>DataView</code> objects as\nhost objects, i.e. pass them to <a href=\"#serializer_writehostobjectobject\"><code>serializer._writeHostObject()</code></a>.</p>" } ], "signatures": [ { "params": [], "desc": "<p>Creates a new <code>Serializer</code> object.</p>" } ] }, { "textRaw": "Class: `v8.Deserializer`", "type": "class", "name": "v8.Deserializer", "meta": { "added": [ "v8.0.0" ], "changes": [] }, "methods": [ { "textRaw": "`deserializer.readHeader()`", "type": "method", "name": "readHeader", "signatures": [ { "params": [] } ], "desc": "<p>Reads and validates a header (including the format version).\nMay, for example, reject an invalid or unsupported wire format. In that case,\nan <code>Error</code> is thrown.</p>" }, { "textRaw": "`deserializer.readValue()`", "type": "method", "name": "readValue", "signatures": [ { "params": [] } ], "desc": "<p>Deserializes a JavaScript value from the buffer and returns it.</p>" }, { "textRaw": "`deserializer.transferArrayBuffer(id, arrayBuffer)`", "type": "method", "name": "transferArrayBuffer", "signatures": [ { "params": [ { "textRaw": "`id` {integer} A 32-bit unsigned integer.", "name": "id", "type": "integer", "desc": "A 32-bit unsigned integer." }, { "textRaw": "`arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An `ArrayBuffer` instance.", "name": "arrayBuffer", "type": "ArrayBuffer|SharedArrayBuffer", "desc": "An `ArrayBuffer` instance." } ] } ], "desc": "<p>Marks an <code>ArrayBuffer</code> as having its contents transferred out of band.\nPass the corresponding <code>ArrayBuffer</code> in the serializing context to\n<a href=\"#serializertransferarraybufferid-arraybuffer\"><code>serializer.transferArrayBuffer()</code></a> (or return the <code>id</code> from\n<a href=\"#serializer_getsharedarraybufferidsharedarraybuffer\"><code>serializer._getSharedArrayBufferId()</code></a> in the case of <code>SharedArrayBuffer</code>s).</p>" }, { "textRaw": "`deserializer.getWireFormatVersion()`", "type": "method", "name": "getWireFormatVersion", "signatures": [ { "return": { "textRaw": "Returns: {integer}", "name": "return", "type": "integer" }, "params": [] } ], "desc": "<p>Reads the underlying wire format version. Likely mostly to be useful to\nlegacy code reading old wire format versions. May not be called before\n<code>.readHeader()</code>.</p>" }, { "textRaw": "`deserializer.readUint32()`", "type": "method", "name": "readUint32", "signatures": [ { "return": { "textRaw": "Returns: {integer}", "name": "return", "type": "integer" }, "params": [] } ], "desc": "<p>Read a raw 32-bit unsigned integer and return it.\nFor use inside of a custom <a href=\"#deserializer_readhostobject\"><code>deserializer._readHostObject()</code></a>.</p>" }, { "textRaw": "`deserializer.readUint64()`", "type": "method", "name": "readUint64", "signatures": [ { "return": { "textRaw": "Returns: {integer\\[]}", "name": "return", "type": "integer\\[]" }, "params": [] } ], "desc": "<p>Read a raw 64-bit unsigned integer and return it as an array <code>[hi, lo]</code>\nwith two 32-bit unsigned integer entries.\nFor use inside of a custom <a href=\"#deserializer_readhostobject\"><code>deserializer._readHostObject()</code></a>.</p>" }, { "textRaw": "`deserializer.readDouble()`", "type": "method", "name": "readDouble", "signatures": [ { "return": { "textRaw": "Returns: {number}", "name": "return", "type": "number" }, "params": [] } ], "desc": "<p>Read a JS <code>number</code> value.\nFor use inside of a custom <a href=\"#deserializer_readhostobject\"><code>deserializer._readHostObject()</code></a>.</p>" }, { "textRaw": "`deserializer.readRawBytes(length)`", "type": "method", "name": "readRawBytes", "signatures": [ { "return": { "textRaw": "Returns: {Buffer}", "name": "return", "type": "Buffer" }, "params": [ { "textRaw": "`length` {integer}", "name": "length", "type": "integer" } ] } ], "desc": "<p>Read raw bytes from the deserializer's internal buffer. The <code>length</code> parameter\nmust correspond to the length of the buffer that was passed to\n<a href=\"#serializerwriterawbytesbuffer\"><code>serializer.writeRawBytes()</code></a>.\nFor use inside of a custom <a href=\"#deserializer_readhostobject\"><code>deserializer._readHostObject()</code></a>.</p>" }, { "textRaw": "`deserializer._readHostObject()`", "type": "method", "name": "_readHostObject", "signatures": [ { "params": [] } ], "desc": "<p>This method is called to read some kind of host object, i.e. an object that is\ncreated by native C++ bindings. If it is not possible to deserialize the data,\na suitable exception should be thrown.</p>\n<p>This method is not present on the <code>Deserializer</code> class itself but can be\nprovided by subclasses.</p>" } ], "signatures": [ { "params": [ { "textRaw": "`buffer` {Buffer|TypedArray|DataView} A buffer returned by [`serializer.releaseBuffer()`][].", "name": "buffer", "type": "Buffer|TypedArray|DataView", "desc": "A buffer returned by [`serializer.releaseBuffer()`][]." } ], "desc": "<p>Creates a new <code>Deserializer</code> object.</p>" } ] }, { "textRaw": "Class: `v8.DefaultSerializer`", "type": "class", "name": "v8.DefaultSerializer", "meta": { "added": [ "v8.0.0" ], "changes": [] }, "desc": "<p>A subclass of <a href=\"#class-v8serializer\"><code>Serializer</code></a> that serializes <code>TypedArray</code>\n(in particular <a href=\"buffer.html\"><code>Buffer</code></a>) and <code>DataView</code> objects as host objects, and only\nstores the part of their underlying <code>ArrayBuffer</code>s that they are referring to.</p>" }, { "textRaw": "Class: `v8.DefaultDeserializer`", "type": "class", "name": "v8.DefaultDeserializer", "meta": { "added": [ "v8.0.0" ], "changes": [] }, "desc": "<p>A subclass of <a href=\"#class-v8deserializer\"><code>Deserializer</code></a> corresponding to the format written by\n<a href=\"#class-v8defaultserializer\"><code>DefaultSerializer</code></a>.</p>" } ], "type": "module", "displayName": "Serialization API" }, { "textRaw": "Promise hooks", "name": "promise_hooks", "desc": "<p>The <code>promiseHooks</code> interface can be used to track promise lifecycle events.\nTo track <em>all</em> async activity, see <a href=\"async_hooks.html\"><code>async_hooks</code></a> which internally uses this\nmodule to produce promise lifecycle events in addition to events for other\nasync resources. For request context management, see <a href=\"async_context.html#class-asynclocalstorage\"><code>AsyncLocalStorage</code></a>.</p>\n<pre><code class=\"language-mjs\">import { promiseHooks } from 'node:v8';\n\n// There are four lifecycle events produced by promises:\n\n// The `init` event represents the creation of a promise. This could be a\n// direct creation such as with `new Promise(...)` or a continuation such\n// as `then()` or `catch()`. It also happens whenever an async function is\n// called or does an `await`. If a continuation promise is created, the\n// `parent` will be the promise it is a continuation from.\nfunction init(promise, parent) {\n console.log('a promise was created', { promise, parent });\n}\n\n// The `settled` event happens when a promise receives a resolution or\n// rejection value. This may happen synchronously such as when using\n// `Promise.resolve()` on non-promise input.\nfunction settled(promise) {\n console.log('a promise resolved or rejected', { promise });\n}\n\n// The `before` event runs immediately before a `then()` or `catch()` handler\n// runs or an `await` resumes execution.\nfunction before(promise) {\n console.log('a promise is about to call a then handler', { promise });\n}\n\n// The `after` event runs immediately after a `then()` handler runs or when\n// an `await` begins after resuming from another.\nfunction after(promise) {\n console.log('a promise is done calling a then handler', { promise });\n}\n\n// Lifecycle hooks may be started and stopped individually\nconst stopWatchingInits = promiseHooks.onInit(init);\nconst stopWatchingSettleds = promiseHooks.onSettled(settled);\nconst stopWatchingBefores = promiseHooks.onBefore(before);\nconst stopWatchingAfters = promiseHooks.onAfter(after);\n\n// Or they may be started and stopped in groups\nconst stopHookSet = promiseHooks.createHook({\n init,\n settled,\n before,\n after\n});\n\n// To stop a hook, call the function returned at its creation.\nstopWatchingInits();\nstopWatchingSettleds();\nstopWatchingBefores();\nstopWatchingAfters();\nstopHookSet();\n</code></pre>", "methods": [ { "textRaw": "`promiseHooks.onInit(init)`", "type": "method", "name": "onInit", "meta": { "added": [ "v16.14.0" ], "changes": [] }, "signatures": [ { "return": { "textRaw": "Returns: {Function} Call to stop the hook.", "name": "return", "type": "Function", "desc": "Call to stop the hook." }, "params": [ { "textRaw": "`init` {Function} The [`init` callback][] to call when a promise is created.", "name": "init", "type": "Function", "desc": "The [`init` callback][] to call when a promise is created." } ] } ], "desc": "<p><strong>The <code>init</code> hook must be a plain function. Providing an async function will\nthrow as it would produce an infinite microtask loop.</strong></p>\n<pre><code class=\"language-mjs\">import { promiseHooks } from 'node:v8';\n\nconst stop = promiseHooks.onInit((promise, parent) => {});\n</code></pre>\n<pre><code class=\"language-cjs\">const { promiseHooks } = require('node:v8');\n\nconst stop = promiseHooks.onInit((promise, parent) => {});\n</code></pre>" }, { "textRaw": "`promiseHooks.onSettled(settled)`", "type": "method", "name": "onSettled", "meta": { "added": [ "v16.14.0" ], "changes": [] }, "signatures": [ { "return": { "textRaw": "Returns: {Function} Call to stop the hook.", "name": "return", "type": "Function", "desc": "Call to stop the hook." }, "params": [ { "textRaw": "`settled` {Function} The [`settled` callback][] to call when a promise is resolved or rejected.", "name": "settled", "type": "Function", "desc": "The [`settled` callback][] to call when a promise is resolved or rejected." } ] } ], "desc": "<p><strong>The <code>settled</code> hook must be a plain function. Providing an async function will\nthrow as it would produce an infinite microtask loop.</strong></p>\n<pre><code class=\"language-mjs\">import { promiseHooks } from 'node:v8';\n\nconst stop = promiseHooks.onSettled((promise) => {});\n</code></pre>\n<pre><code class=\"language-cjs\">const { promiseHooks } = require('node:v8');\n\nconst stop = promiseHooks.onSettled((promise) => {});\n</code></pre>" }, { "textRaw": "`promiseHooks.onBefore(before)`", "type": "method", "name": "onBefore", "meta": { "added": [ "v16.14.0" ], "changes": [] }, "signatures": [ { "return": { "textRaw": "Returns: {Function} Call to stop the hook.", "name": "return", "type": "Function", "desc": "Call to stop the hook." }, "params": [ { "textRaw": "`before` {Function} The [`before` callback][] to call before a promise continuation executes.", "name": "before", "type": "Function", "desc": "The [`before` callback][] to call before a promise continuation executes." } ] } ], "desc": "<p><strong>The <code>before</code> hook must be a plain function. Providing an async function will\nthrow as it would produce an infinite microtask loop.</strong></p>\n<pre><code class=\"language-mjs\">import { promiseHooks } from 'node:v8';\n\nconst stop = promiseHooks.onBefore((promise) => {});\n</code></pre>\n<pre><code class=\"language-cjs\">const { promiseHooks } = require('node:v8');\n\nconst stop = promiseHooks.onBefore((promise) => {});\n</code></pre>" }, { "textRaw": "`promiseHooks.onAfter(after)`", "type": "method", "name": "onAfter", "meta": { "added": [ "v16.14.0" ], "changes": [] }, "signatures": [ { "return": { "textRaw": "Returns: {Function} Call to stop the hook.", "name": "return", "type": "Function", "desc": "Call to stop the hook." }, "params": [ { "textRaw": "`after` {Function} The [`after` callback][] to call after a promise continuation executes.", "name": "after", "type": "Function", "desc": "The [`after` callback][] to call after a promise continuation executes." } ] } ], "desc": "<p><strong>The <code>after</code> hook must be a plain function. Providing an async function will\nthrow as it would produce an infinite microtask loop.</strong></p>\n<pre><code class=\"language-mjs\">import { promiseHooks } from 'node:v8';\n\nconst stop = promiseHooks.onAfter((promise) => {});\n</code></pre>\n<pre><code class=\"language-cjs\">const { promiseHooks } = require('node:v8');\n\nconst stop = promiseHooks.onAfter((promise) => {});\n</code></pre>" }, { "textRaw": "`promiseHooks.createHook(callbacks)`", "type": "method", "name": "createHook", "meta": { "added": [ "v16.14.0" ], "changes": [] }, "signatures": [ { "return": { "textRaw": "Returns: {Function} Used for disabling hooks", "name": "return", "type": "Function", "desc": "Used for disabling hooks" }, "params": [ { "textRaw": "`callbacks` {Object} The [Hook Callbacks][] to register", "name": "callbacks", "type": "Object", "desc": "The [Hook Callbacks][] to register", "options": [ { "textRaw": "`init` {Function} The [`init` callback][].", "name": "init", "type": "Function", "desc": "The [`init` callback][]." }, { "textRaw": "`before` {Function} The [`before` callback][].", "name": "before", "type": "Function", "desc": "The [`before` callback][]." }, { "textRaw": "`after` {Function} The [`after` callback][].", "name": "after", "type": "Function", "desc": "The [`after` callback][]." }, { "textRaw": "`settled` {Function} The [`settled` callback][].", "name": "settled", "type": "Function", "desc": "The [`settled` callback][]." } ] } ] } ], "desc": "<p><strong>The hook callbacks must be plain functions. Providing async functions will\nthrow as it would produce an infinite microtask loop.</strong></p>\n<p>Registers functions to be called for different lifetime events of each promise.</p>\n<p>The callbacks <code>init()</code>/<code>before()</code>/<code>after()</code>/<code>settled()</code> are called for the\nrespective events during a promise's lifetime.</p>\n<p>All callbacks are optional. For example, if only promise creation needs to\nbe tracked, then only the <code>init</code> callback needs to be passed. The\nspecifics of all functions that can be passed to <code>callbacks</code> is in the\n<a href=\"#hook-callbacks\">Hook Callbacks</a> section.</p>\n<pre><code class=\"language-mjs\">import { promiseHooks } from 'node:v8';\n\nconst stopAll = promiseHooks.createHook({\n init(promise, parent) {}\n});\n</code></pre>\n<pre><code class=\"language-cjs\">const { promiseHooks } = require('node:v8');\n\nconst stopAll = promiseHooks.createHook({\n init(promise, parent) {}\n});\n</code></pre>" } ], "modules": [ { "textRaw": "Hook callbacks", "name": "hook_callbacks", "desc": "<p>Key events in the lifetime of a promise have been categorized into four areas:\ncreation of a promise, before/after a continuation handler is called or around\nan await, and when the promise resolves or rejects.</p>\n<p>While these hooks are similar to those of <a href=\"async_hooks.html\"><code>async_hooks</code></a> they lack a\n<code>destroy</code> hook. Other types of async resources typically represent sockets or\nfile descriptors which have a distinct \"closed\" state to express the <code>destroy</code>\nlifecycle event while promises remain usable for as long as code can still\nreach them. Garbage collection tracking is used to make promises fit into the\n<code>async_hooks</code> event model, however this tracking is very expensive and they may\nnot necessarily ever even be garbage collected.</p>\n<p>Because promises are asynchronous resources whose lifecycle is tracked\nvia the promise hooks mechanism, the <code>init()</code>, <code>before()</code>, <code>after()</code>, and\n<code>settled()</code> callbacks <em>must not</em> be async functions as they create more\npromises which would produce an infinite loop.</p>\n<p>While this API is used to feed promise events into <a href=\"async_hooks.html\"><code>async_hooks</code></a>, the\nordering between the two is undefined. Both APIs are multi-tenant\nand therefore could produce events in any order relative to each other.</p>", "methods": [ { "textRaw": "`init(promise, parent)`", "type": "method", "name": "init", "signatures": [ { "params": [ { "textRaw": "`promise` {Promise} The promise being created.", "name": "promise", "type": "Promise", "desc": "The promise being created." }, { "textRaw": "`parent` {Promise} The promise continued from, if applicable.", "name": "parent", "type": "Promise", "desc": "The promise continued from, if applicable." } ] } ], "desc": "<p>Called when a promise is constructed. This <em>does not</em> mean that corresponding\n<code>before</code>/<code>after</code> events will occur, only that the possibility exists. This will\nhappen if a promise is created without ever getting a continuation.</p>" }, { "textRaw": "`before(promise)`", "type": "method", "name": "before", "signatures": [ { "params": [ { "textRaw": "`promise` {Promise}", "name": "promise", "type": "Promise" } ] } ], "desc": "<p>Called before a promise continuation executes. This can be in the form of\n<code>then()</code>, <code>catch()</code>, or <code>finally()</code> handlers or an <code>await</code> resuming.</p>\n<p>The <code>before</code> callback will be called 0 to N times. The <code>before</code> callback\nwill typically be called 0 times if no continuation was ever made for the\npromise. The <code>before</code> callback may be called many times in the case where\nmany continuations have been made from the same promise.</p>" }, { "textRaw": "`after(promise)`", "type": "method", "name": "after", "signatures": [ { "params": [ { "textRaw": "`promise` {Promise}", "name": "promise", "type": "Promise" } ] } ], "desc": "<p>Called immediately after a promise continuation executes. This may be after a\n<code>then()</code>, <code>catch()</code>, or <code>finally()</code> handler or before an <code>await</code> after another\n<code>await</code>.</p>" }, { "textRaw": "`settled(promise)`", "type": "method", "name": "settled", "signatures": [ { "params": [ { "textRaw": "`promise` {Promise}", "name": "promise", "type": "Promise" } ] } ], "desc": "<p>Called when the promise receives a resolution or rejection value. This may\noccur synchronously in the case of <code>Promise.resolve()</code> or <code>Promise.reject()</code>.</p>" } ], "type": "module", "displayName": "Hook callbacks" } ], "type": "module", "displayName": "Promise hooks" }, { "textRaw": "Startup Snapshot API", "name": "startup_snapshot_api", "meta": { "added": [ "v16.17.0" ], "changes": [] }, "stability": 1, "stabilityText": "Experimental", "desc": "<p>The <code>v8.startupSnapshot</code> interface can be used to add serialization and\ndeserialization hooks for custom startup snapshots. Currently the startup\nsnapshots can only be built into the Node.js binary from source.</p>\n<pre><code class=\"language-console\">$ cd /path/to/node\n$ ./configure --node-snapshot-main=entry.js\n$ make node\n# This binary contains the result of the execution of entry.js\n$ out/Release/node\n</code></pre>\n<p>In the example above, <code>entry.js</code> can use methods from the <code>v8.startupSnapshot</code>\ninterface to specify how to save information for custom objects in the snapshot\nduring serialization and how the information can be used to synchronize these\nobjects during deserialization of the snapshot. For example, if the <code>entry.js</code>\ncontains the following script:</p>\n<pre><code class=\"language-cjs\">'use strict';\n\nconst fs = require('fs');\nconst zlib = require('zlib');\nconst path = require('path');\nconst assert = require('assert');\n\nconst {\n isBuildingSnapshot,\n addSerializeCallback,\n addDeserializeCallback,\n setDeserializeMainFunction\n} = require('v8').startupSnapshot;\n\nconst filePath = path.resolve(__dirname, '../x1024.txt');\nconst storage = {};\n\nassert(isBuildingSnapshot());\n\naddSerializeCallback(({ filePath }) => {\n storage[filePath] = zlib.gzipSync(fs.readFileSync(filePath));\n}, { filePath });\n\naddDeserializeCallback(({ filePath }) => {\n storage[filePath] = zlib.gunzipSync(storage[filePath]);\n}, { filePath });\n\nsetDeserializeMainFunction(({ filePath }) => {\n console.log(storage[filePath].toString());\n}, { filePath });\n</code></pre>\n<p>The resulted binary will simply print the data deserialized from the snapshot\nduring start up:</p>\n<pre><code class=\"language-console\">$ out/Release/node\n# Prints content of ./test/fixtures/x1024.txt\n</code></pre>\n<p>Currently the API is only available to a Node.js instance launched from the\ndefault snapshot, that is, the application deserialized from a user-land\nsnapshot cannot use these APIs again.</p>", "methods": [ { "textRaw": "`v8.startupSnapshot.addSerializeCallback(callback[, data])`", "type": "method", "name": "addSerializeCallback", "meta": { "added": [ "v16.17.0" ], "changes": [] }, "signatures": [ { "params": [ { "textRaw": "`callback` {Function} Callback to be invoked before serialization.", "name": "callback", "type": "Function", "desc": "Callback to be invoked before serialization." }, { "textRaw": "`data` {any} Optional data that will be passed to the `callback` when it gets called.", "name": "data", "type": "any", "desc": "Optional data that will be passed to the `callback` when it gets called." } ] } ], "desc": "<p>Add a callback that will be called when the Node.js instance is about to\nget serialized into a snapshot and exit. This can be used to release\nresources that should not or cannot be serialized or to convert user data\ninto a form more suitable for serialization.</p>" }, { "textRaw": "`v8.startupSnapshot.addDeserializeCallback(callback[, data])`", "type": "method", "name": "addDeserializeCallback", "meta": { "added": [ "v16.17.0" ], "changes": [] }, "signatures": [ { "params": [ { "textRaw": "`callback` {Function} Callback to be invoked after the snapshot is deserialized.", "name": "callback", "type": "Function", "desc": "Callback to be invoked after the snapshot is deserialized." }, { "textRaw": "`data` {any} Optional data that will be passed to the `callback` when it gets called.", "name": "data", "type": "any", "desc": "Optional data that will be passed to the `callback` when it gets called." } ] } ], "desc": "<p>Add a callback that will be called when the Node.js instance is deserialized\nfrom a snapshot. The <code>callback</code> and the <code>data</code> (if provided) will be\nserialized into the snapshot, they can be used to re-initialize the state\nof the application or to re-acquire resources that the application needs\nwhen the application is restarted from the snapshot.</p>" }, { "textRaw": "`v8.startupSnapshot.setDeserializeMainFunction(callback[, data])`", "type": "method", "name": "setDeserializeMainFunction", "meta": { "added": [ "v16.17.0" ], "changes": [] }, "signatures": [ { "params": [ { "textRaw": "`callback` {Function} Callback to be invoked as the entry point after the snapshot is deserialized.", "name": "callback", "type": "Function", "desc": "Callback to be invoked as the entry point after the snapshot is deserialized." }, { "textRaw": "`data` {any} Optional data that will be passed to the `callback` when it gets called.", "name": "data", "type": "any", "desc": "Optional data that will be passed to the `callback` when it gets called." } ] } ], "desc": "<p>This sets the entry point of the Node.js application when it is deserialized\nfrom a snapshot. This can be called only once in the snapshot building\nscript. If called, the deserialized application no longer needs an additional\nentry point script to start up and will simply invoke the callback along with\nthe deserialized data (if provided), otherwise an entry point script still\nneeds to be provided to the deserialized application.</p>" }, { "textRaw": "`v8.startupSnapshot.isBuildingSnapshot()`", "type": "method", "name": "isBuildingSnapshot", "meta": { "added": [ "v16.17.0" ], "changes": [] }, "signatures": [ { "return": { "textRaw": "Returns: {boolean}", "name": "return", "type": "boolean" }, "params": [] } ], "desc": "<p>Returns true if the Node.js instance is run to build a snapshot.</p>" } ], "type": "module", "displayName": "Startup Snapshot API" } ], "type": "module", "displayName": "V8" } ] }
.
Edit
..
Edit
addons.html
Edit
addons.json
Edit
addons.md
Edit
all.html
Edit
all.json
Edit
assert.html
Edit
assert.json
Edit
assert.md
Edit
assets
Edit
async_context.html
Edit
async_context.json
Edit
async_context.md
Edit
async_hooks.html
Edit
async_hooks.json
Edit
async_hooks.md
Edit
buffer.html
Edit
buffer.json
Edit
buffer.md
Edit
child_process.html
Edit
child_process.json
Edit
child_process.md
Edit
cli.html
Edit
cli.json
Edit
cli.md
Edit
cluster.html
Edit
cluster.json
Edit
cluster.md
Edit
console.html
Edit
console.json
Edit
console.md
Edit
corepack.html
Edit
corepack.json
Edit
corepack.md
Edit
crypto.html
Edit
crypto.json
Edit
crypto.md
Edit
debugger.html
Edit
debugger.json
Edit
debugger.md
Edit
deprecations.html
Edit
deprecations.json
Edit
deprecations.md
Edit
dgram.html
Edit
dgram.json
Edit
dgram.md
Edit
diagnostics_channel.html
Edit
diagnostics_channel.json
Edit
diagnostics_channel.md
Edit
dns.html
Edit
dns.json
Edit
dns.md
Edit
documentation.html
Edit
documentation.json
Edit
documentation.md
Edit
domain.html
Edit
domain.json
Edit
domain.md
Edit
embedding.html
Edit
embedding.json
Edit
embedding.md
Edit
errors.html
Edit
errors.json
Edit
errors.md
Edit
esm.html
Edit
esm.json
Edit
esm.md
Edit
events.html
Edit
events.json
Edit
events.md
Edit
fs.html
Edit
fs.json
Edit
fs.md
Edit
globals.html
Edit
globals.json
Edit
globals.md
Edit
http.html
Edit
http.json
Edit
http.md
Edit
http2.html
Edit
http2.json
Edit
http2.md
Edit
https.html
Edit
https.json
Edit
https.md
Edit
index.html
Edit
index.json
Edit
index.md
Edit
inspector.html
Edit
inspector.json
Edit
inspector.md
Edit
intl.html
Edit
intl.json
Edit
intl.md
Edit
module.html
Edit
module.json
Edit
module.md
Edit
modules.html
Edit
modules.json
Edit
modules.md
Edit
n-api.html
Edit
n-api.json
Edit
n-api.md
Edit
net.html
Edit
net.json
Edit
net.md
Edit
os.html
Edit
os.json
Edit
os.md
Edit
packages.html
Edit
packages.json
Edit
packages.md
Edit
path.html
Edit
path.json
Edit
path.md
Edit
perf_hooks.html
Edit
perf_hooks.json
Edit
perf_hooks.md
Edit
permissions.html
Edit
permissions.json
Edit
permissions.md
Edit
policy.html
Edit
policy.json
Edit
policy.md
Edit
process.html
Edit
process.json
Edit
process.md
Edit
punycode.html
Edit
punycode.json
Edit
punycode.md
Edit
querystring.html
Edit
querystring.json
Edit
querystring.md
Edit
readline.html
Edit
readline.json
Edit
readline.md
Edit
repl.html
Edit
repl.json
Edit
repl.md
Edit
report.html
Edit
report.json
Edit
report.md
Edit
stream.html
Edit
stream.json
Edit
stream.md
Edit
string_decoder.html
Edit
string_decoder.json
Edit
string_decoder.md
Edit
synopsis.html
Edit
synopsis.json
Edit
synopsis.md
Edit
test.html
Edit
test.json
Edit
test.md
Edit
timers.html
Edit
timers.json
Edit
timers.md
Edit
tls.html
Edit
tls.json
Edit
tls.md
Edit
tracing.html
Edit
tracing.json
Edit
tracing.md
Edit
tty.html
Edit
tty.json
Edit
tty.md
Edit
url.html
Edit
url.json
Edit
url.md
Edit
util.html
Edit
util.json
Edit
util.md
Edit
v8.html
Edit
v8.json
Edit
v8.md
Edit
vm.html
Edit
vm.json
Edit
vm.md
Edit
wasi.html
Edit
wasi.json
Edit
wasi.md
Edit
webcrypto.html
Edit
webcrypto.json
Edit
webcrypto.md
Edit
webstreams.html
Edit
webstreams.json
Edit
webstreams.md
Edit
worker_threads.html
Edit
worker_threads.json
Edit
worker_threads.md
Edit
zlib.html
Edit
zlib.json
Edit
zlib.md
Edit