{"$schema":"https://doc-kit.nodejs.org/schemas/api-doc/1.0.0.json","id":"util","path":"/util","type":"module","module":"util","title":"Util","introducedIn":"v0.10.0","sourceLink":{"path":"lib/util.js","url":"https://github.com/nodejs/node/blob/HEAD/lib/util.js"},"stability":{"index":"2","description":"Stable"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `node:util` module supports the needs of Node.js internal APIs. Many of the\nutilities are useful for application and module developers as well. To access\nit:\n\n```mjs\nimport util from 'node:util';\n```\n\n```cjs\nconst util = require('node:util');\n```","summary":"The `node:util` module supports the needs of Node.js internal APIs. Many of the utilities are useful for application and module developers as well. To access it:","examples":[{"language":"mjs","displayName":null,"code":"import util from 'node:util';"},{"language":"cjs","displayName":null,"code":"const util = require('node:util');"}],"children":[{"kind":"method","id":"utilcallbackifyoriginal","name":"callbackify","title":"`util.callbackify(original)`","scope":"module","overloadOf":null,"stability":null,"added":["v8.2.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"original","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"An `async` function","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"a callback style function"}},"description":"Takes an `async` function (or a function that returns a `Promise`) and returns a\nfunction following the error-first callback style, i.e. taking\nan `(err, value) => ...` callback as the last argument. In the callback, the\nfirst argument will be the rejection reason (or `null` if the `Promise`\nresolved), and the second argument will be the resolved value.\n\n```mjs\nimport { callbackify } from 'node:util';\n\nasync function fn() {\n  return 'hello world';\n}\nconst callbackFunction = callbackify(fn);\n\ncallbackFunction((err, ret) => {\n  if (err) throw err;\n  console.log(ret);\n});\n```\n\n```cjs\nconst { callbackify } = require('node:util');\n\nasync function fn() {\n  return 'hello world';\n}\nconst callbackFunction = callbackify(fn);\n\ncallbackFunction((err, ret) => {\n  if (err) throw err;\n  console.log(ret);\n});\n```\n\nWill print:\n\n```text\nhello world\n```\n\nThe callback is executed asynchronously, and will have a limited stack trace.\nIf the callback throws, the process will emit an [`'uncaughtException'`](process.html#event-uncaughtexception)\nevent, and if not handled will exit.\n\nSince `null` has a special meaning as the first argument to a callback, if a\nwrapped function rejects a `Promise` with a falsy value as a reason, the value\nis wrapped in an `Error` with the original value stored in a field named\n`reason`.\n\n```mjs\nimport util from 'node:util';\n\nfunction fn() {\n  return Promise.reject(null);\n}\nconst callbackFunction = util.callbackify(fn);\n\ncallbackFunction((err, ret) => {\n  // When the Promise was rejected with `null` it is wrapped with an Error and\n  // the original value is stored in `reason`.\n  err && Object.hasOwn(err, 'reason') && err.reason === null;  // true\n});\n```\n\n```cjs\nconst util = require('node:util');\n\nfunction fn() {\n  return Promise.reject(null);\n}\nconst callbackFunction = util.callbackify(fn);\n\ncallbackFunction((err, ret) => {\n  // When the Promise was rejected with `null` it is wrapped with an Error and\n  // the original value is stored in `reason`.\n  err && Object.hasOwn(err, 'reason') && err.reason === null;  // true\n});\n```","summary":"Takes an `async` function (or a function that returns a `Promise`) and returns a function following the error-first callback style, i.e. taking an `(err, value) => ...` callback as the last argument. In the callback, the first argument will be the rejection reason (or `null` if the `Promise` resolved), and the second argument will be the resolved value.","examples":[{"language":"mjs","displayName":null,"code":"import { callbackify } from 'node:util';\n\nasync function fn() {\n  return 'hello world';\n}\nconst callbackFunction = callbackify(fn);\n\ncallbackFunction((err, ret) => {\n  if (err) throw err;\n  console.log(ret);\n});"},{"language":"cjs","displayName":null,"code":"const { callbackify } = require('node:util');\n\nasync function fn() {\n  return 'hello world';\n}\nconst callbackFunction = callbackify(fn);\n\ncallbackFunction((err, ret) => {\n  if (err) throw err;\n  console.log(ret);\n});"},{"language":"text","displayName":null,"code":"hello world"},{"language":"mjs","displayName":null,"code":"import util from 'node:util';\n\nfunction fn() {\n  return Promise.reject(null);\n}\nconst callbackFunction = util.callbackify(fn);\n\ncallbackFunction((err, ret) => {\n  // When the Promise was rejected with `null` it is wrapped with an Error and\n  // the original value is stored in `reason`.\n  err && Object.hasOwn(err, 'reason') && err.reason === null;  // true\n});"},{"language":"cjs","displayName":null,"code":"const util = require('node:util');\n\nfunction fn() {\n  return Promise.reject(null);\n}\nconst callbackFunction = util.callbackify(fn);\n\ncallbackFunction((err, ret) => {\n  // When the Promise was rejected with `null` it is wrapped with an Error and\n  // the original value is stored in `reason`.\n  err && Object.hasOwn(err, 'reason') && err.reason === null;  // true\n});"}],"children":[]},{"kind":"method","id":"utilconvertprocesssignaltoexitcodesignal","name":"convertProcessSignalToExitCode","title":"`util.convertProcessSignalToExitCode(signal)`","scope":"module","overloadOf":null,"stability":null,"added":["v25.4.0","v24.14.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"signal","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A signal name (e.g. `'SIGTERM'`)","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The exit code corresponding to `signal`"}},"description":"The `util.convertProcessSignalToExitCode()` method converts a signal name to its\ncorresponding POSIX exit code. Following the POSIX standard, the exit code\nfor a process terminated by a signal is calculated as `128 + signal number`.\n\nIf `signal` is not a valid signal name, then an error will be thrown. See\n[`signal(7)`](https://man7.org/linux/man-pages/man7/signal.7.html) for a list of valid signals.\n\n```mjs\nimport { convertProcessSignalToExitCode } from 'node:util';\n\nconsole.log(convertProcessSignalToExitCode('SIGTERM')); // 143 (128 + 15)\nconsole.log(convertProcessSignalToExitCode('SIGKILL')); // 137 (128 + 9)\n```\n\n```cjs\nconst { convertProcessSignalToExitCode } = require('node:util');\n\nconsole.log(convertProcessSignalToExitCode('SIGTERM')); // 143 (128 + 15)\nconsole.log(convertProcessSignalToExitCode('SIGKILL')); // 137 (128 + 9)\n```\n\nThis is particularly useful when working with processes to determine\nthe exit code based on the signal that terminated the process.","summary":"The `util.convertProcessSignalToExitCode()` method converts a signal name to its corresponding POSIX exit code. Following the POSIX standard, the exit code for a process terminated by a signal is calculated as `128 + signal number`.","examples":[{"language":"mjs","displayName":null,"code":"import { convertProcessSignalToExitCode } from 'node:util';\n\nconsole.log(convertProcessSignalToExitCode('SIGTERM')); // 143 (128 + 15)\nconsole.log(convertProcessSignalToExitCode('SIGKILL')); // 137 (128 + 9)"},{"language":"cjs","displayName":null,"code":"const { convertProcessSignalToExitCode } = require('node:util');\n\nconsole.log(convertProcessSignalToExitCode('SIGTERM')); // 143 (128 + 15)\nconsole.log(convertProcessSignalToExitCode('SIGKILL')); // 137 (128 + 9)"}],"children":[]},{"kind":"method","id":"utildebuglogsection-callback","name":"debuglog","title":"`util.debuglog(section[, callback])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.3"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"section","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A string identifying the portion of the application for\nwhich the `debuglog` function is being created.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"A callback invoked the first time the logging function\nis called with a function argument that is a more optimized logging function.","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The logging function"}},"description":"The `util.debuglog()` method is used to create a function that conditionally\nwrites debug messages to `stderr` based on the existence of the `NODE_DEBUG`\nenvironment variable. If the `section` name appears within the value of that\nenvironment variable, then the returned function operates similar to\n[`console.error()`](console.html#consoleerrordata-args). If not, then the returned function is a no-op.\n\n```mjs\nimport { debuglog } from 'node:util';\nconst log = debuglog('foo');\n\nlog('hello from foo [%d]', 123);\n```\n\n```cjs\nconst { debuglog } = require('node:util');\nconst log = debuglog('foo');\n\nlog('hello from foo [%d]', 123);\n```\n\nIf this program is run with `NODE_DEBUG=foo` in the environment, then\nit will output something like:\n\n```console\nFOO 3245: hello from foo [123]\n```\n\nwhere `3245` is the process id. If it is not run with that\nenvironment variable set, then it will not print anything.\n\nThe `section` supports wildcard also:\n\n```mjs\nimport { debuglog } from 'node:util';\nconst log = debuglog('foo-bar');\n\nlog('hi there, it\\'s foo-bar [%d]', 2333);\n```\n\n```cjs\nconst { debuglog } = require('node:util');\nconst log = debuglog('foo-bar');\n\nlog('hi there, it\\'s foo-bar [%d]', 2333);\n```\n\nif it is run with `NODE_DEBUG=foo*` in the environment, then it will output\nsomething like:\n\n```console\nFOO-BAR 3257: hi there, it's foo-bar [2333]\n```\n\nMultiple comma-separated `section` names may be specified in the `NODE_DEBUG`\nenvironment variable: `NODE_DEBUG=fs,net,tls`.\n\nThe optional `callback` argument can be used to replace the logging function\nwith a different function that doesn't have any initialization or\nunnecessary wrapping.\n\n```mjs\nimport { debuglog } from 'node:util';\nlet log = debuglog('internals', (debug) => {\n  // Replace with a logging function that optimizes out\n  // testing if the section is enabled\n  log = debug;\n});\n```\n\n```cjs\nconst { debuglog } = require('node:util');\nlet log = debuglog('internals', (debug) => {\n  // Replace with a logging function that optimizes out\n  // testing if the section is enabled\n  log = debug;\n});\n```","summary":"The `util.debuglog()` method is used to create a function that conditionally writes debug messages to `stderr` based on the existence of the `NODE_DEBUG` environment variable. If the `section` name appears within the value of that environment variable, then the returned function operates similar to `console.error()`. If not, then the returned function is a no-op.","examples":[{"language":"mjs","displayName":null,"code":"import { debuglog } from 'node:util';\nconst log = debuglog('foo');\n\nlog('hello from foo [%d]', 123);"},{"language":"cjs","displayName":null,"code":"const { debuglog } = require('node:util');\nconst log = debuglog('foo');\n\nlog('hello from foo [%d]', 123);"},{"language":"console","displayName":null,"code":"FOO 3245: hello from foo [123]"},{"language":"mjs","displayName":null,"code":"import { debuglog } from 'node:util';\nconst log = debuglog('foo-bar');\n\nlog('hi there, it\\'s foo-bar [%d]', 2333);"},{"language":"cjs","displayName":null,"code":"const { debuglog } = require('node:util');\nconst log = debuglog('foo-bar');\n\nlog('hi there, it\\'s foo-bar [%d]', 2333);"},{"language":"console","displayName":null,"code":"FOO-BAR 3257: hi there, it's foo-bar [2333]"},{"language":"mjs","displayName":null,"code":"import { debuglog } from 'node:util';\nlet log = debuglog('internals', (debug) => {\n  // Replace with a logging function that optimizes out\n  // testing if the section is enabled\n  log = debug;\n});"},{"language":"cjs","displayName":null,"code":"const { debuglog } = require('node:util');\nlet log = debuglog('internals', (debug) => {\n  // Replace with a logging function that optimizes out\n  // testing if the section is enabled\n  log = debug;\n});"}],"children":[{"kind":"section","id":"debuglogenabled","name":"debuglog().enabled","title":"`debuglog().enabled`","scope":"module","overloadOf":null,"stability":null,"added":["v14.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"* Type: {boolean}\n\nThe `util.debuglog().enabled` getter is used to create a test that can be used\nin conditionals based on the existence of the `NODE_DEBUG` environment variable.\nIf the `section` name appears within the value of that environment variable,\nthen the returned value will be `true`. If not, then the returned value will be\n`false`.\n\n```mjs\nimport { debuglog } from 'node:util';\nconst enabled = debuglog('foo').enabled;\nif (enabled) {\n  console.log('hello from foo [%d]', 123);\n}\n```\n\n```cjs\nconst { debuglog } = require('node:util');\nconst enabled = debuglog('foo').enabled;\nif (enabled) {\n  console.log('hello from foo [%d]', 123);\n}\n```\n\nIf this program is run with `NODE_DEBUG=foo` in the environment, then it will\noutput something like:\n\n```console\nhello from foo [123]\n```","summary":"The `util.debuglog().enabled` getter is used to create a test that can be used in conditionals based on the existence of the `NODE_DEBUG` environment variable. If the `section` name appears within the value of that environment variable, then the returned value will be `true`. If not, then the returned value will be `false`.","examples":[{"language":"mjs","displayName":null,"code":"import { debuglog } from 'node:util';\nconst enabled = debuglog('foo').enabled;\nif (enabled) {\n  console.log('hello from foo [%d]', 123);\n}"},{"language":"cjs","displayName":null,"code":"const { debuglog } = require('node:util');\nconst enabled = debuglog('foo').enabled;\nif (enabled) {\n  console.log('hello from foo [%d]', 123);\n}"},{"language":"console","displayName":null,"code":"hello from foo [123]"}],"children":[]}]},{"kind":"method","id":"utildebugsection","name":"debug","title":"`util.debug(section)`","scope":"module","overloadOf":null,"stability":null,"added":["v14.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"section","type":null,"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Alias for `util.debuglog`. Usage allows for readability of that doesn't imply\nlogging when only using `util.debuglog().enabled`.","summary":"Alias for `util.debuglog`. Usage allows for readability of that doesn't imply logging when only using `util.debuglog().enabled`.","examples":[],"children":[]},{"kind":"method","id":"utildeprecatefn-msg-code-options","name":"deprecate","title":"`util.deprecate(fn, msg[, code[, options]])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v25.2.0","v24.12.0"],"prUrl":"https://github.com/nodejs/node/pull/59982","commit":null,"description":"Add options object with modifyPrototype to conditionally modify the prototype of the deprecated object."},{"versions":["v10.0.0"],"prUrl":"https://github.com/nodejs/node/pull/16393","commit":null,"description":"Deprecation warnings are only emitted once for each code."}],"signature":{"parameters":[{"name":"fn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The function that is being deprecated.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"msg","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A warning message to display when the deprecated function is\ninvoked.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"code","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A deprecation code. See the [list of deprecated APIs](deprecations.html#list-of-deprecated-apis) for a\nlist of codes.","default":null,"optional":true,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"modifyPrototype","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"When false do not change the prototype of object\nwhile emitting the deprecation warning.","default":"true","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"The deprecated function wrapped to emit a warning."}},"description":"The `util.deprecate()` method wraps `fn` (which may be a function or class) in\nsuch a way that it is marked as deprecated.\n\n```mjs\nimport { deprecate } from 'node:util';\n\nexport const obsoleteFunction = deprecate(() => {\n  // Do something here.\n}, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.');\n```\n\n```cjs\nconst { deprecate } = require('node:util');\n\nexports.obsoleteFunction = deprecate(() => {\n  // Do something here.\n}, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.');\n```\n\nWhen called, `util.deprecate()` will return a function that will emit a\n`DeprecationWarning` using the [`'warning'`](process.html#event-warning) event. The warning will\nbe emitted and printed to `stderr` the first time the returned function is\ncalled. After the warning is emitted, the wrapped function is called without\nemitting a warning.\n\nIf the same optional `code` is supplied in multiple calls to `util.deprecate()`,\nthe warning will be emitted only once for that `code`.\n\n```mjs\nimport { deprecate } from 'node:util';\n\nconst fn1 = deprecate(\n  () => 'a value',\n  'deprecation message',\n  'DEP0001',\n);\nconst fn2 = deprecate(\n  () => 'a  different value',\n  'other dep message',\n  'DEP0001',\n);\nfn1(); // Emits a deprecation warning with code DEP0001\nfn2(); // Does not emit a deprecation warning because it has the same code\n```\n\n```cjs\nconst { deprecate } = require('node:util');\n\nconst fn1 = deprecate(\n  function() {\n    return 'a value';\n  },\n  'deprecation message',\n  'DEP0001',\n);\nconst fn2 = deprecate(\n  function() {\n    return 'a  different value';\n  },\n  'other dep message',\n  'DEP0001',\n);\nfn1(); // Emits a deprecation warning with code DEP0001\nfn2(); // Does not emit a deprecation warning because it has the same code\n```\n\nIf either the `--no-deprecation` or `--no-warnings` command-line flags are\nused, or if the `process.noDeprecation` property is set to `true` *prior* to\nthe first deprecation warning, the `util.deprecate()` method does nothing.\n\nIf the `--trace-deprecation` or `--trace-warnings` command-line flags are set,\nor the `process.traceDeprecation` property is set to `true`, a warning and a\nstack trace are printed to `stderr` the first time the deprecated function is\ncalled.\n\nIf the `--throw-deprecation` command-line flag is set, or the\n`process.throwDeprecation` property is set to `true`, then an exception will be\nthrown when the deprecated function is called.\n\nThe `--throw-deprecation` command-line flag and `process.throwDeprecation`\nproperty take precedence over `--trace-deprecation` and\n`process.traceDeprecation`.","summary":"The `util.deprecate()` method wraps `fn` (which may be a function or class) in such a way that it is marked as deprecated.","examples":[{"language":"mjs","displayName":null,"code":"import { deprecate } from 'node:util';\n\nexport const obsoleteFunction = deprecate(() => {\n  // Do something here.\n}, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.');"},{"language":"cjs","displayName":null,"code":"const { deprecate } = require('node:util');\n\nexports.obsoleteFunction = deprecate(() => {\n  // Do something here.\n}, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.');"},{"language":"mjs","displayName":null,"code":"import { deprecate } from 'node:util';\n\nconst fn1 = deprecate(\n  () => 'a value',\n  'deprecation message',\n  'DEP0001',\n);\nconst fn2 = deprecate(\n  () => 'a  different value',\n  'other dep message',\n  'DEP0001',\n);\nfn1(); // Emits a deprecation warning with code DEP0001\nfn2(); // Does not emit a deprecation warning because it has the same code"},{"language":"cjs","displayName":null,"code":"const { deprecate } = require('node:util');\n\nconst fn1 = deprecate(\n  function() {\n    return 'a value';\n  },\n  'deprecation message',\n  'DEP0001',\n);\nconst fn2 = deprecate(\n  function() {\n    return 'a  different value';\n  },\n  'other dep message',\n  'DEP0001',\n);\nfn1(); // Emits a deprecation warning with code DEP0001\nfn2(); // Does not emit a deprecation warning because it has the same code"}],"children":[]},{"kind":"method","id":"utildiffactual-expected","name":"diff","title":"`util.diff(actual, expected)`","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v23.11.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"actual","type":{"text":"Array | string","links":[{"name":"Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array","start":0,"end":5},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":8,"end":14}]},"description":"The first value to compare","default":null,"optional":false,"rest":false,"properties":[]},{"name":"expected","type":{"text":"Array | string","links":[{"name":"Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array","start":0,"end":5},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":8,"end":14}]},"description":"The second value to compare","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Array","links":[{"name":"Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array","start":0,"end":5}]},"description":"An array of difference entries. Each entry is an array with two elements:"}},"description":"* Algorithm complexity: O(N\\*D), where:\n\n* N is the total length of the two sequences combined (N = actual.length + expected.length)\n\n* D is the edit distance (the minimum number of operations required to transform one sequence into the other).\n\n[`util.diff()`](#utildiffactual-expected) compares two string or array values and returns an array of difference entries.\nIt uses the Myers diff algorithm to compute minimal differences, which is the same algorithm\nused internally by assertion error messages.\n\nIf the values are equal, an empty array is returned.\n\n```js\nconst { diff } = require('node:util');\n\n// Comparing strings\nconst actualString = '12345678';\nconst expectedString = '12!!5!7!';\nconsole.log(diff(actualString, expectedString));\n// [\n//   [0, '1'],\n//   [0, '2'],\n//   [1, '3'],\n//   [1, '4'],\n//   [-1, '!'],\n//   [-1, '!'],\n//   [0, '5'],\n//   [1, '6'],\n//   [-1, '!'],\n//   [0, '7'],\n//   [1, '8'],\n//   [-1, '!'],\n// ]\n// Comparing arrays\nconst actualArray = ['1', '2', '3'];\nconst expectedArray = ['1', '3', '4'];\nconsole.log(diff(actualArray, expectedArray));\n// [\n//   [0, '1'],\n//   [1, '2'],\n//   [0, '3'],\n//   [-1, '4'],\n// ]\n// Equal values return empty array\nconsole.log(diff('same', 'same'));\n// []\n```","summary":"`util.diff()` compares two string or array values and returns an array of difference entries. It uses the Myers diff algorithm to compute minimal differences, which is the same algorithm used internally by assertion error messages.","examples":[{"language":"js","displayName":null,"code":"const { diff } = require('node:util');\n\n// Comparing strings\nconst actualString = '12345678';\nconst expectedString = '12!!5!7!';\nconsole.log(diff(actualString, expectedString));\n// [\n//   [0, '1'],\n//   [0, '2'],\n//   [1, '3'],\n//   [1, '4'],\n//   [-1, '!'],\n//   [-1, '!'],\n//   [0, '5'],\n//   [1, '6'],\n//   [-1, '!'],\n//   [0, '7'],\n//   [1, '8'],\n//   [-1, '!'],\n// ]\n// Comparing arrays\nconst actualArray = ['1', '2', '3'];\nconst expectedArray = ['1', '3', '4'];\nconsole.log(diff(actualArray, expectedArray));\n// [\n//   [0, '1'],\n//   [1, '2'],\n//   [0, '3'],\n//   [-1, '4'],\n// ]\n// Equal values return empty array\nconsole.log(diff('same', 'same'));\n// []"}],"children":[]},{"kind":"method","id":"utilformatformat-args","name":"format","title":"`util.format(format[, ...args])`","scope":"module","overloadOf":null,"stability":null,"added":["v0.5.3"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v12.11.0"],"prUrl":"https://github.com/nodejs/node/pull/29606","commit":null,"description":"The `%c` specifier is ignored now."},{"versions":["v12.0.0"],"prUrl":"https://github.com/nodejs/node/pull/23162","commit":null,"description":"The `format` argument is now only taken as such if it actually contains format specifiers."},{"versions":["v12.0.0"],"prUrl":"https://github.com/nodejs/node/pull/23162","commit":null,"description":"If the `format` argument is not a format string, the output string's formatting is no longer dependent on the type of the first argument. This change removes previously present quotes from strings that were being output when the first argument was not a string."},{"versions":["v11.4.0"],"prUrl":"https://github.com/nodejs/node/pull/23708","commit":null,"description":"The `%d`, `%f`, and `%i` specifiers now support Symbols properly."},{"versions":["v11.4.0"],"prUrl":"https://github.com/nodejs/node/pull/24806","commit":null,"description":"The `%o` specifier's `depth` has default depth of 4 again."},{"versions":["v11.0.0"],"prUrl":"https://github.com/nodejs/node/pull/17907","commit":null,"description":"The `%o` specifier's `depth` option will now fall back to the default depth."},{"versions":["v10.12.0"],"prUrl":"https://github.com/nodejs/node/pull/22097","commit":null,"description":"The `%d` and `%i` specifiers now support BigInt."},{"versions":["v8.4.0"],"prUrl":"https://github.com/nodejs/node/pull/14558","commit":null,"description":"The `%o` and `%O` specifiers are supported now."}],"signature":{"parameters":[{"name":"format","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A `printf`-like format string.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"args","type":null,"description":"","default":null,"optional":true,"rest":true,"properties":[]}],"returns":null},"description":"The `util.format()` method returns a formatted string using the first argument\nas a `printf`-like format string which can contain zero or more format\nspecifiers. Each specifier is replaced with the converted value from the\ncorresponding argument. Supported specifiers are:\n\n* `%s`: `String` will be used to convert all values except `BigInt`, `Object`\n  and `-0`. `BigInt` values will be represented with an `n` and Objects that\n  have neither a user defined `toString` function nor `Symbol.toPrimitive` function are inspected using `util.inspect()`\n  with options `{ depth: 0, colors: false, compact: 3 }`.\n* `%d`: `Number` will be used to convert all values except `BigInt` and\n  `Symbol`.\n* `%i`: `parseInt(value, 10)` is used for all values except `BigInt` and\n  `Symbol`.\n* `%f`: `parseFloat(value)` is used for all values except `Symbol`.\n* `%j`: JSON. Replaced with the string `'[Circular]'` if the argument contains\n  circular references.\n* `%o`: `Object`. A string representation of an object with generic JavaScript\n  object formatting. Similar to `util.inspect()` with options\n  `{ showHidden: true, showProxy: true }`. This will show the full object\n  including non-enumerable properties and proxies.\n* `%O`: `Object`. A string representation of an object with generic JavaScript\n  object formatting. Similar to `util.inspect()` without options. This will show\n  the full object not including non-enumerable properties and proxies.\n* `%c`: `CSS`. This specifier is ignored and will skip any CSS passed in.\n* `%%`: single percent sign (`'%'`). This does not consume an argument.\n* Returns: {string} The formatted string\n\nIf a specifier does not have a corresponding argument, it is not replaced:\n\n```js\nutil.format('%s:%s', 'foo');\n// Returns: 'foo:%s'\n```\n\nValues that are not part of the format string are formatted using\n`util.inspect()` if their type is not `string`.\n\nIf there are more arguments passed to the `util.format()` method than the\nnumber of specifiers, the extra arguments are concatenated to the returned\nstring, separated by spaces:\n\n```js\nutil.format('%s:%s', 'foo', 'bar', 'baz');\n// Returns: 'foo:bar baz'\n```\n\nIf the first argument does not contain a valid format specifier, `util.format()`\nreturns a string that is the concatenation of all arguments separated by spaces:\n\n```js\nutil.format(1, 2, 3);\n// Returns: '1 2 3'\n```\n\nIf only one argument is passed to `util.format()`, it is returned as it is\nwithout any formatting:\n\n```js\nutil.format('%% %s');\n// Returns: '%% %s'\n```\n\n`util.format()` is a synchronous method that is intended as a debugging tool.\nSome input values can have a significant performance overhead that can block the\nevent loop. Use this function with care and never in a hot code path.","summary":"The `util.format()` method returns a formatted string using the first argument as a `printf`-like format string which can contain zero or more format specifiers. Each specifier is replaced with the converted value from the corresponding argument. Supported specifiers are:","examples":[{"language":"js","displayName":null,"code":"util.format('%s:%s', 'foo');\n// Returns: 'foo:%s'"},{"language":"js","displayName":null,"code":"util.format('%s:%s', 'foo', 'bar', 'baz');\n// Returns: 'foo:bar baz'"},{"language":"js","displayName":null,"code":"util.format(1, 2, 3);\n// Returns: '1 2 3'"},{"language":"js","displayName":null,"code":"util.format('%% %s');\n// Returns: '%% %s'"}],"children":[]},{"kind":"method","id":"utilformatwithoptionsinspectoptions-format-args","name":"formatWithOptions","title":"`util.formatWithOptions(inspectOptions, format[, ...args])`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"inspectOptions","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"format","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"args","type":null,"description":"","default":null,"optional":true,"rest":true,"properties":[]}],"returns":null},"description":"This function is identical to [`util.format()`](#utilformatformat-args), except in that it takes\nan `inspectOptions` argument which specifies options that are passed along to\n[`util.inspect()`](#utilinspectobject-options).\n\n```js\nutil.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 });\n// Returns 'See object { foo: 42 }', where `42` is colored as a number\n// when printed to a terminal.\n```","summary":"This function is identical to `util.format()`, except in that it takes an `inspectOptions` argument which specifies options that are passed along to `util.inspect()`.","examples":[{"language":"js","displayName":null,"code":"util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 });\n// Returns 'See object { foo: 42 }', where `42` is colored as a number\n// when printed to a terminal."}],"children":[]},{"kind":"method","id":"utilgetcallsitesframecount-options","name":"getCallSites","title":"`util.getCallSites([frameCount][, options])`","scope":"module","overloadOf":null,"stability":{"index":"1.1","description":"Active development"},"added":["v22.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v23.7.0","v22.14.0"],"prUrl":"https://github.com/nodejs/node/pull/56584","commit":null,"description":"Property `column` is deprecated in favor of `columnNumber`."},{"versions":["v23.7.0","v22.14.0"],"prUrl":"https://github.com/nodejs/node/pull/56551","commit":null,"description":"Property `CallSite.scriptId` is exposed."},{"versions":["v23.3.0","v22.12.0"],"prUrl":"https://github.com/nodejs/node/pull/55626","commit":null,"description":"The API is renamed from `util.getCallSite` to `util.getCallSites()`."}],"signature":{"parameters":[{"name":"frameCount","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"Optional number of frames to capture as call site objects.","default":"`10`. Allowable range is between 1 and 200","optional":true,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Optional","default":null,"optional":true,"rest":false,"properties":[{"name":"sourceMap","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Reconstruct the original location in the stacktrace from the source-map.\nEnabled by default with the flag `--enable-source-maps`.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Object[]","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"An array of call site objects"}},"description":"Returns an array of call site objects containing the stack of\nthe caller function.\n\nUnlike accessing an `error.stack`, the result returned from this API is not\ninterfered with `Error.prepareStackTrace`.\n\n```mjs\nimport { getCallSites } from 'node:util';\n\nfunction exampleFunction() {\n  const callSites = getCallSites();\n\n  console.log('Call Sites:');\n  callSites.forEach((callSite, index) => {\n    console.log(`CallSite ${index + 1}:`);\n    console.log(`Function Name: ${callSite.functionName}`);\n    console.log(`Script Name: ${callSite.scriptName}`);\n    console.log(`Line Number: ${callSite.lineNumber}`);\n    console.log(`Column Number: ${callSite.columnNumber}`);\n  });\n  // CallSite 1:\n  // Function Name: exampleFunction\n  // Script Name: /home/example.js\n  // Line Number: 5\n  // Column Number: 26\n\n  // CallSite 2:\n  // Function Name: anotherFunction\n  // Script Name: /home/example.js\n  // Line Number: 22\n  // Column Number: 3\n\n  // ...\n}\n\n// A function to simulate another stack layer\nfunction anotherFunction() {\n  exampleFunction();\n}\n\nanotherFunction();\n```\n\n```cjs\nconst { getCallSites } = require('node:util');\n\nfunction exampleFunction() {\n  const callSites = getCallSites();\n\n  console.log('Call Sites:');\n  callSites.forEach((callSite, index) => {\n    console.log(`CallSite ${index + 1}:`);\n    console.log(`Function Name: ${callSite.functionName}`);\n    console.log(`Script Name: ${callSite.scriptName}`);\n    console.log(`Line Number: ${callSite.lineNumber}`);\n    console.log(`Column Number: ${callSite.columnNumber}`);\n  });\n  // CallSite 1:\n  // Function Name: exampleFunction\n  // Script Name: /home/example.js\n  // Line Number: 5\n  // Column Number: 26\n\n  // CallSite 2:\n  // Function Name: anotherFunction\n  // Script Name: /home/example.js\n  // Line Number: 22\n  // Column Number: 3\n\n  // ...\n}\n\n// A function to simulate another stack layer\nfunction anotherFunction() {\n  exampleFunction();\n}\n\nanotherFunction();\n```\n\nIt is possible to reconstruct the original locations by setting the option `sourceMap` to `true`.\nIf the source map is not available, the original location will be the same as the current location.\nWhen the `--enable-source-maps` flag is enabled,`sourceMap` will be true by default.\n\n```ts\nimport { getCallSites } from 'node:util';\n\ninterface Foo {\n  foo: string;\n}\n\nconst callSites = getCallSites({ sourceMap: true });\n\n// With sourceMap:\n// Function Name: ''\n// Script Name: example.js\n// Line Number: 7\n// Column Number: 26\n\n// Without sourceMap:\n// Function Name: ''\n// Script Name: example.js\n// Line Number: 2\n// Column Number: 26\n```\n\n```cjs\nconst { getCallSites } = require('node:util');\n\nconst callSites = getCallSites({ sourceMap: true });\n\n// With sourceMap:\n// Function Name: ''\n// Script Name: example.js\n// Line Number: 7\n// Column Number: 26\n\n// Without sourceMap:\n// Function Name: ''\n// Script Name: example.js\n// Line Number: 2\n// Column Number: 26\n```","summary":"Returns an array of call site objects containing the stack of the caller function.","examples":[{"language":"mjs","displayName":null,"code":"import { getCallSites } from 'node:util';\n\nfunction exampleFunction() {\n  const callSites = getCallSites();\n\n  console.log('Call Sites:');\n  callSites.forEach((callSite, index) => {\n    console.log(`CallSite ${index + 1}:`);\n    console.log(`Function Name: ${callSite.functionName}`);\n    console.log(`Script Name: ${callSite.scriptName}`);\n    console.log(`Line Number: ${callSite.lineNumber}`);\n    console.log(`Column Number: ${callSite.columnNumber}`);\n  });\n  // CallSite 1:\n  // Function Name: exampleFunction\n  // Script Name: /home/example.js\n  // Line Number: 5\n  // Column Number: 26\n\n  // CallSite 2:\n  // Function Name: anotherFunction\n  // Script Name: /home/example.js\n  // Line Number: 22\n  // Column Number: 3\n\n  // ...\n}\n\n// A function to simulate another stack layer\nfunction anotherFunction() {\n  exampleFunction();\n}\n\nanotherFunction();"},{"language":"cjs","displayName":null,"code":"const { getCallSites } = require('node:util');\n\nfunction exampleFunction() {\n  const callSites = getCallSites();\n\n  console.log('Call Sites:');\n  callSites.forEach((callSite, index) => {\n    console.log(`CallSite ${index + 1}:`);\n    console.log(`Function Name: ${callSite.functionName}`);\n    console.log(`Script Name: ${callSite.scriptName}`);\n    console.log(`Line Number: ${callSite.lineNumber}`);\n    console.log(`Column Number: ${callSite.columnNumber}`);\n  });\n  // CallSite 1:\n  // Function Name: exampleFunction\n  // Script Name: /home/example.js\n  // Line Number: 5\n  // Column Number: 26\n\n  // CallSite 2:\n  // Function Name: anotherFunction\n  // Script Name: /home/example.js\n  // Line Number: 22\n  // Column Number: 3\n\n  // ...\n}\n\n// A function to simulate another stack layer\nfunction anotherFunction() {\n  exampleFunction();\n}\n\nanotherFunction();"},{"language":"ts","displayName":null,"code":"import { getCallSites } from 'node:util';\n\ninterface Foo {\n  foo: string;\n}\n\nconst callSites = getCallSites({ sourceMap: true });\n\n// With sourceMap:\n// Function Name: ''\n// Script Name: example.js\n// Line Number: 7\n// Column Number: 26\n\n// Without sourceMap:\n// Function Name: ''\n// Script Name: example.js\n// Line Number: 2\n// Column Number: 26"},{"language":"cjs","displayName":null,"code":"const { getCallSites } = require('node:util');\n\nconst callSites = getCallSites({ sourceMap: true });\n\n// With sourceMap:\n// Function Name: ''\n// Script Name: example.js\n// Line Number: 7\n// Column Number: 26\n\n// Without sourceMap:\n// Function Name: ''\n// Script Name: example.js\n// Line Number: 2\n// Column Number: 26"}],"children":[]},{"kind":"method","id":"utilgetsystemerrornameerr","name":"getSystemErrorName","title":"`util.getSystemErrorName(err)`","scope":"module","overloadOf":null,"stability":null,"added":["v9.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"err","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":""}},"description":"Returns the string name for a numeric error code that comes from a Node.js API.\nThe mapping between error codes and error names is platform-dependent.\nSee [Common System Errors](errors.html#common-system-errors) for the names of common errors.\n\n```js\nfs.access('file/that/does/not/exist', (err) => {\n  const name = util.getSystemErrorName(err.errno);\n  console.error(name);  // ENOENT\n});\n```","summary":"Returns the string name for a numeric error code that comes from a Node.js API. The mapping between error codes and error names is platform-dependent. See Common System Errors for the names of common errors.","examples":[{"language":"js","displayName":null,"code":"fs.access('file/that/does/not/exist', (err) => {\n  const name = util.getSystemErrorName(err.errno);\n  console.error(name);  // ENOENT\n});"}],"children":[]},{"kind":"method","id":"utilgetsystemerrormap","name":"getSystemErrorMap","title":"`util.getSystemErrorMap()`","scope":"module","overloadOf":null,"stability":null,"added":["v16.0.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Map","links":[{"name":"Map","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map","start":0,"end":3}]},"description":""}},"description":"Returns a Map of all system error codes available from the Node.js API.\nThe mapping between error codes and error names is platform-dependent.\nSee [Common System Errors](errors.html#common-system-errors) for the names of common errors.\n\n```js\nfs.access('file/that/does/not/exist', (err) => {\n  const errorMap = util.getSystemErrorMap();\n  const name = errorMap.get(err.errno);\n  console.error(name);  // ENOENT\n});\n```","summary":"Returns a Map of all system error codes available from the Node.js API. The mapping between error codes and error names is platform-dependent. See Common System Errors for the names of common errors.","examples":[{"language":"js","displayName":null,"code":"fs.access('file/that/does/not/exist', (err) => {\n  const errorMap = util.getSystemErrorMap();\n  const name = errorMap.get(err.errno);\n  console.error(name);  // ENOENT\n});"}],"children":[]},{"kind":"method","id":"utilgetsystemerrormessageerr","name":"getSystemErrorMessage","title":"`util.getSystemErrorMessage(err)`","scope":"module","overloadOf":null,"stability":null,"added":["v23.1.0","v22.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"err","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":""}},"description":"Returns the string message for a numeric error code that comes from a Node.js\nAPI.\nThe mapping between error codes and string messages is platform-dependent.\n\n```js\nfs.access('file/that/does/not/exist', (err) => {\n  const message = util.getSystemErrorMessage(err.errno);\n  console.error(message);  // No such file or directory\n});\n```","summary":"Returns the string message for a numeric error code that comes from a Node.js API. The mapping between error codes and string messages is platform-dependent.","examples":[{"language":"js","displayName":null,"code":"fs.access('file/that/does/not/exist', (err) => {\n  const message = util.getSystemErrorMessage(err.errno);\n  console.error(message);  // No such file or directory\n});"}],"children":[]},{"kind":"method","id":"utilsettracesigintenable","name":"setTraceSigInt","title":"`util.setTraceSigInt(enable)`","scope":"module","overloadOf":null,"stability":null,"added":["v24.6.0","v22.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"enable","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Enable or disable printing a stack trace on `SIGINT`. The API is only available on the main thread.","summary":"Enable or disable printing a stack trace on `SIGINT`. The API is only available on the main thread.","examples":[],"children":[]},{"kind":"method","id":"utilinheritsconstructor-superconstructor","name":"inherits","title":"`util.inherits(constructor, superConstructor)`","scope":"module","overloadOf":null,"stability":{"index":"3","description":"Legacy: Use ES2015 class syntax and `extends` keyword instead."},"added":["v0.3.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v5.0.0"],"prUrl":"https://github.com/nodejs/node/pull/3455","commit":null,"description":"The `constructor` parameter can refer to an ES6 class now."}],"signature":{"parameters":[{"name":"constructor","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"superConstructor","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and\n`extends` keywords to get language level inheritance support. Also note\nthat the two styles are [semantically incompatible](https://github.com/nodejs/node/issues/4179).\n\nInherit the prototype methods from one [constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor) into another. The\nprototype of `constructor` will be set to a new object created from\n`superConstructor`.\n\nThis mainly adds some input validation on top of\n`Object.setPrototypeOf(constructor.prototype, superConstructor.prototype)`.\nAs an additional convenience, `superConstructor` will be accessible\nthrough the `constructor.super_` property.\n\n```js\nconst util = require('node:util');\nconst EventEmitter = require('node:events');\n\nfunction MyStream() {\n  EventEmitter.call(this);\n}\n\nutil.inherits(MyStream, EventEmitter);\n\nMyStream.prototype.write = function(data) {\n  this.emit('data', data);\n};\n\nconst stream = new MyStream();\n\nconsole.log(stream instanceof EventEmitter); // true\nconsole.log(MyStream.super_ === EventEmitter); // true\n\nstream.on('data', (data) => {\n  console.log(`Received data: \"${data}\"`);\n});\nstream.write('It works!'); // Received data: \"It works!\"\n```\n\nES6 example using `class` and `extends`:\n\n```mjs\nimport EventEmitter from 'node:events';\n\nclass MyStream extends EventEmitter {\n  write(data) {\n    this.emit('data', data);\n  }\n}\n\nconst stream = new MyStream();\n\nstream.on('data', (data) => {\n  console.log(`Received data: \"${data}\"`);\n});\nstream.write('With ES6');\n```\n\n```cjs\nconst EventEmitter = require('node:events');\n\nclass MyStream extends EventEmitter {\n  write(data) {\n    this.emit('data', data);\n  }\n}\n\nconst stream = new MyStream();\n\nstream.on('data', (data) => {\n  console.log(`Received data: \"${data}\"`);\n});\nstream.write('With ES6');\n```","summary":"Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and `extends` keywords to get language level inheritance support. Also note that the two styles are semantically incompatible.","examples":[{"language":"js","displayName":null,"code":"const util = require('node:util');\nconst EventEmitter = require('node:events');\n\nfunction MyStream() {\n  EventEmitter.call(this);\n}\n\nutil.inherits(MyStream, EventEmitter);\n\nMyStream.prototype.write = function(data) {\n  this.emit('data', data);\n};\n\nconst stream = new MyStream();\n\nconsole.log(stream instanceof EventEmitter); // true\nconsole.log(MyStream.super_ === EventEmitter); // true\n\nstream.on('data', (data) => {\n  console.log(`Received data: \"${data}\"`);\n});\nstream.write('It works!'); // Received data: \"It works!\""},{"language":"mjs","displayName":null,"code":"import EventEmitter from 'node:events';\n\nclass MyStream extends EventEmitter {\n  write(data) {\n    this.emit('data', data);\n  }\n}\n\nconst stream = new MyStream();\n\nstream.on('data', (data) => {\n  console.log(`Received data: \"${data}\"`);\n});\nstream.write('With ES6');"},{"language":"cjs","displayName":null,"code":"const EventEmitter = require('node:events');\n\nclass MyStream extends EventEmitter {\n  write(data) {\n    this.emit('data', data);\n  }\n}\n\nconst stream = new MyStream();\n\nstream.on('data', (data) => {\n  console.log(`Received data: \"${data}\"`);\n});\nstream.write('With ES6');"}],"children":[]},{"kind":"method","id":"utilinspectobject-options","name":"inspect","title":"`util.inspect(object[, options])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"object","type":null,"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"utilinspectobject-showhidden-depth-colors","name":"inspect","title":"`util.inspect(object[, showHidden[, depth[, colors]]])`","scope":"module","overloadOf":"utilinspectobject-options","stability":null,"added":["v0.3.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v25.0.0"],"prUrl":"https://github.com/nodejs/node/pull/59710","commit":null,"description":"The util.inspect.styles.regexp style is now a method that is invoked for coloring the stringified regular expression."},{"versions":["v17.3.0","v16.14.0"],"prUrl":"https://github.com/nodejs/node/pull/41003","commit":null,"description":"The `numericSeparator` option is supported now."},{"versions":["v16.18.0"],"prUrl":"https://github.com/nodejs/node/pull/43576","commit":null,"description":"add support for `maxArrayLength` when inspecting `Set` and `Map`."},{"versions":["v14.6.0","v12.19.0"],"prUrl":"https://github.com/nodejs/node/pull/33690","commit":null,"description":"If `object` is from a different `vm.Context` now, a custom inspection function on it will not receive context-specific arguments anymore."},{"versions":["v13.13.0","v12.17.0"],"prUrl":"https://github.com/nodejs/node/pull/32392","commit":null,"description":"The `maxStringLength` option is supported now."},{"versions":["v13.5.0","v12.16.0"],"prUrl":"https://github.com/nodejs/node/pull/30768","commit":null,"description":"User defined prototype properties are inspected in case `showHidden` is `true`."},{"versions":["v13.0.0"],"prUrl":"https://github.com/nodejs/node/pull/27685","commit":null,"description":"Circular references now include a marker to the reference."},{"versions":["v12.0.0"],"prUrl":"https://github.com/nodejs/node/pull/27109","commit":null,"description":"The `compact` options default is changed to `3` and the `breakLength` options default is changed to `80`."},{"versions":["v12.0.0"],"prUrl":"https://github.com/nodejs/node/pull/24971","commit":null,"description":"Internal properties no longer appear in the context argument of a custom inspection function."},{"versions":["v11.11.0"],"prUrl":"https://github.com/nodejs/node/pull/26269","commit":null,"description":"The `compact` option accepts numbers for a new output mode."},{"versions":["v11.7.0"],"prUrl":"https://github.com/nodejs/node/pull/25006","commit":null,"description":"ArrayBuffers now also show their binary contents."},{"versions":["v11.5.0"],"prUrl":"https://github.com/nodejs/node/pull/24852","commit":null,"description":"The `getters` option is supported now."},{"versions":["v11.4.0"],"prUrl":"https://github.com/nodejs/node/pull/24326","commit":null,"description":"The `depth` default changed back to `2`."},{"versions":["v11.0.0"],"prUrl":"https://github.com/nodejs/node/pull/22846","commit":null,"description":"The `depth` default changed to `20`."},{"versions":["v11.0.0"],"prUrl":"https://github.com/nodejs/node/pull/22756","commit":null,"description":"The inspection output is now limited to about 128 MiB. Data above that size will not be fully inspected."},{"versions":["v10.12.0"],"prUrl":"https://github.com/nodejs/node/pull/22788","commit":null,"description":"The `sorted` option is supported now."},{"versions":["v10.6.0"],"prUrl":"https://github.com/nodejs/node/pull/20725","commit":null,"description":"Inspecting linked lists and similar objects is now possible up to the maximum call stack size."},{"versions":["v10.0.0"],"prUrl":"https://github.com/nodejs/node/pull/19259","commit":null,"description":"The `WeakMap` and `WeakSet` entries can now be inspected as well."},{"versions":["v9.9.0"],"prUrl":"https://github.com/nodejs/node/pull/17576","commit":null,"description":"The `compact` option is supported now."},{"versions":["v6.6.0"],"prUrl":"https://github.com/nodejs/node/pull/8174","commit":null,"description":"Custom inspection functions can now return `this`."},{"versions":["v6.3.0"],"prUrl":"https://github.com/nodejs/node/pull/7499","commit":null,"description":"The `breakLength` option is supported now."},{"versions":["v6.1.0"],"prUrl":"https://github.com/nodejs/node/pull/6334","commit":null,"description":"The `maxArrayLength` option is supported now; in particular, long arrays are truncated by default."},{"versions":["v6.1.0"],"prUrl":"https://github.com/nodejs/node/pull/6465","commit":null,"description":"The `showProxy` option is supported now."}],"signature":{"parameters":[{"name":"object","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"Any JavaScript primitive or `Object`.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"showHidden","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, `object`'s non-enumerable symbols and\nproperties are included in the formatted result. {WeakMap} and\n{WeakSet} entries are also included as well as user defined prototype\nproperties (excluding method properties).","default":"false","optional":true,"rest":false,"properties":[]},{"name":"depth","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Specifies the number of times to recurse while formatting\n`object`. This is useful for inspecting large objects. To recurse up to\nthe maximum call stack size pass `Infinity` or `null`.","default":"2","optional":true,"rest":false,"properties":[]},{"name":"colors","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, the output is styled with ANSI color\ncodes. Colors are customizable. See [Customizing `util.inspect` colors](#customizing-utilinspect-colors).","default":"false","optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The representation of `object`."}},"description":"The `util.inspect()` method returns a string representation of `object` that is\nintended for debugging. The output of `util.inspect` may change at any time\nand should not be depended upon programmatically. Additional `options` may be\npassed that alter the result.\n`util.inspect()` will use the constructor's name and/or `Symbol.toStringTag`\nproperty to make an identifiable tag for an inspected value.\n\n```js\nclass Foo {\n  get [Symbol.toStringTag]() {\n    return 'bar';\n  }\n}\n\nclass Bar {}\n\nconst baz = Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } });\n\nutil.inspect(new Foo()); // 'Foo [bar] {}'\nutil.inspect(new Bar()); // 'Bar {}'\nutil.inspect(baz);       // '[foo] {}'\n```\n\nCircular references point to their anchor by using a reference index:\n\n```mjs\nimport { inspect } from 'node:util';\n\nconst obj = {};\nobj.a = [obj];\nobj.b = {};\nobj.b.inner = obj.b;\nobj.b.obj = obj;\n\nconsole.log(inspect(obj));\n// <ref *1> {\n//   a: [ [Circular *1] ],\n//   b: <ref *2> { inner: [Circular *2], obj: [Circular *1] }\n// }\n```\n\n```cjs\nconst { inspect } = require('node:util');\n\nconst obj = {};\nobj.a = [obj];\nobj.b = {};\nobj.b.inner = obj.b;\nobj.b.obj = obj;\n\nconsole.log(inspect(obj));\n// <ref *1> {\n//   a: [ [Circular *1] ],\n//   b: <ref *2> { inner: [Circular *2], obj: [Circular *1] }\n// }\n```\n\nThe following example inspects all properties of the `util` object:\n\n```mjs\nimport util from 'node:util';\n\nconsole.log(util.inspect(util, { showHidden: true, depth: null }));\n```\n\n```cjs\nconst util = require('node:util');\n\nconsole.log(util.inspect(util, { showHidden: true, depth: null }));\n```\n\nThe following example highlights the effect of the `compact` option:\n\n```mjs\nimport { inspect } from 'node:util';\n\nconst o = {\n  a: [1, 2, [[\n    'Lorem ipsum dolor sit amet,\\nconsectetur adipiscing elit, sed do ' +\n      'eiusmod \\ntempor incididunt ut labore et dolore magna aliqua.',\n    'test',\n    'foo']], 4],\n  b: new Map([['za', 1], ['zb', 'test']]),\n};\nconsole.log(inspect(o, { compact: true, depth: 5, breakLength: 80 }));\n\n// { a:\n//   [ 1,\n//     2,\n//     [ [ 'Lorem ipsum dolor sit amet,\\nconsectetur [...]', // A long line\n//           'test',\n//           'foo' ] ],\n//     4 ],\n//   b: Map(2) { 'za' => 1, 'zb' => 'test' } }\n\n// Setting `compact` to false or an integer creates more reader friendly output.\nconsole.log(inspect(o, { compact: false, depth: 5, breakLength: 80 }));\n\n// {\n//   a: [\n//     1,\n//     2,\n//     [\n//       [\n//         'Lorem ipsum dolor sit amet,\\n' +\n//           'consectetur adipiscing elit, sed do eiusmod \\n' +\n//           'tempor incididunt ut labore et dolore magna aliqua.',\n//         'test',\n//         'foo'\n//       ]\n//     ],\n//     4\n//   ],\n//   b: Map(2) {\n//     'za' => 1,\n//     'zb' => 'test'\n//   }\n// }\n\n// Setting `breakLength` to e.g. 150 will print the \"Lorem ipsum\" text in a\n// single line.\n```\n\n```cjs\nconst { inspect } = require('node:util');\n\nconst o = {\n  a: [1, 2, [[\n    'Lorem ipsum dolor sit amet,\\nconsectetur adipiscing elit, sed do ' +\n      'eiusmod \\ntempor incididunt ut labore et dolore magna aliqua.',\n    'test',\n    'foo']], 4],\n  b: new Map([['za', 1], ['zb', 'test']]),\n};\nconsole.log(inspect(o, { compact: true, depth: 5, breakLength: 80 }));\n\n// { a:\n//   [ 1,\n//     2,\n//     [ [ 'Lorem ipsum dolor sit amet,\\nconsectetur [...]', // A long line\n//           'test',\n//           'foo' ] ],\n//     4 ],\n//   b: Map(2) { 'za' => 1, 'zb' => 'test' } }\n\n// Setting `compact` to false or an integer creates more reader friendly output.\nconsole.log(inspect(o, { compact: false, depth: 5, breakLength: 80 }));\n\n// {\n//   a: [\n//     1,\n//     2,\n//     [\n//       [\n//         'Lorem ipsum dolor sit amet,\\n' +\n//           'consectetur adipiscing elit, sed do eiusmod \\n' +\n//           'tempor incididunt ut labore et dolore magna aliqua.',\n//         'test',\n//         'foo'\n//       ]\n//     ],\n//     4\n//   ],\n//   b: Map(2) {\n//     'za' => 1,\n//     'zb' => 'test'\n//   }\n// }\n\n// Setting `breakLength` to e.g. 150 will print the \"Lorem ipsum\" text in a\n// single line.\n```\n\nThe `showHidden` option allows {WeakMap} and {WeakSet} entries to be\ninspected. If there are more entries than `maxArrayLength`, there is no\nguarantee which entries are displayed. That means retrieving the same\n{WeakSet} entries twice may result in different output. Furthermore, entries\nwith no remaining strong references may be garbage collected at any time.\n\n```mjs\nimport { inspect } from 'node:util';\n\nconst obj = { a: 1 };\nconst obj2 = { b: 2 };\nconst weakSet = new WeakSet([obj, obj2]);\n\nconsole.log(inspect(weakSet, { showHidden: true }));\n// WeakSet { { a: 1 }, { b: 2 } }\n```\n\n```cjs\nconst { inspect } = require('node:util');\n\nconst obj = { a: 1 };\nconst obj2 = { b: 2 };\nconst weakSet = new WeakSet([obj, obj2]);\n\nconsole.log(inspect(weakSet, { showHidden: true }));\n// WeakSet { { a: 1 }, { b: 2 } }\n```\n\nThe `sorted` option ensures that an object's property insertion order does not\nimpact the result of `util.inspect()`.\n\n```mjs\nimport { inspect } from 'node:util';\nimport assert from 'node:assert';\n\nconst o1 = {\n  b: [2, 3, 1],\n  a: '`a` comes before `b`',\n  c: new Set([2, 3, 1]),\n};\nconsole.log(inspect(o1, { sorted: true }));\n// { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } }\nconsole.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) }));\n// { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' }\n\nconst o2 = {\n  c: new Set([2, 1, 3]),\n  a: '`a` comes before `b`',\n  b: [2, 3, 1],\n};\nassert.strict.equal(\n  inspect(o1, { sorted: true }),\n  inspect(o2, { sorted: true }),\n);\n```\n\n```cjs\nconst { inspect } = require('node:util');\nconst assert = require('node:assert');\n\nconst o1 = {\n  b: [2, 3, 1],\n  a: '`a` comes before `b`',\n  c: new Set([2, 3, 1]),\n};\nconsole.log(inspect(o1, { sorted: true }));\n// { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } }\nconsole.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) }));\n// { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' }\n\nconst o2 = {\n  c: new Set([2, 1, 3]),\n  a: '`a` comes before `b`',\n  b: [2, 3, 1],\n};\nassert.strict.equal(\n  inspect(o1, { sorted: true }),\n  inspect(o2, { sorted: true }),\n);\n```\n\nThe `numericSeparator` option adds an underscore every three digits to all\nnumbers.\n\n```mjs\nimport { inspect } from 'node:util';\n\nconst thousand = 1000;\nconst million = 1000000;\nconst bigNumber = 123456789n;\nconst bigDecimal = 1234.12345;\n\nconsole.log(inspect(thousand, { numericSeparator: true }));\n// 1_000\nconsole.log(inspect(million, { numericSeparator: true }));\n// 1_000_000\nconsole.log(inspect(bigNumber, { numericSeparator: true }));\n// 123_456_789n\nconsole.log(inspect(bigDecimal, { numericSeparator: true }));\n// 1_234.123_45\n```\n\n```cjs\nconst { inspect } = require('node:util');\n\nconst thousand = 1000;\nconst million = 1000000;\nconst bigNumber = 123456789n;\nconst bigDecimal = 1234.12345;\n\nconsole.log(inspect(thousand, { numericSeparator: true }));\n// 1_000\nconsole.log(inspect(million, { numericSeparator: true }));\n// 1_000_000\nconsole.log(inspect(bigNumber, { numericSeparator: true }));\n// 123_456_789n\nconsole.log(inspect(bigDecimal, { numericSeparator: true }));\n// 1_234.123_45\n```\n\n`util.inspect()` is a synchronous method intended for debugging. Its maximum\noutput length is approximately 128 MiB. Inputs that result in longer output will\nbe truncated.","summary":"The `util.inspect()` method returns a string representation of `object` that is intended for debugging. The output of `util.inspect` may change at any time and should not be depended upon programmatically. Additional `options` may be passed that alter the result. `util.inspect()` will use the constructor's name and/or `Symbol.toStringTag` property to make an identifiable tag for an inspected value.","examples":[{"language":"js","displayName":null,"code":"class Foo {\n  get [Symbol.toStringTag]() {\n    return 'bar';\n  }\n}\n\nclass Bar {}\n\nconst baz = Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } });\n\nutil.inspect(new Foo()); // 'Foo [bar] {}'\nutil.inspect(new Bar()); // 'Bar {}'\nutil.inspect(baz);       // '[foo] {}'"},{"language":"mjs","displayName":null,"code":"import { inspect } from 'node:util';\n\nconst obj = {};\nobj.a = [obj];\nobj.b = {};\nobj.b.inner = obj.b;\nobj.b.obj = obj;\n\nconsole.log(inspect(obj));\n// <ref *1> {\n//   a: [ [Circular *1] ],\n//   b: <ref *2> { inner: [Circular *2], obj: [Circular *1] }\n// }"},{"language":"cjs","displayName":null,"code":"const { inspect } = require('node:util');\n\nconst obj = {};\nobj.a = [obj];\nobj.b = {};\nobj.b.inner = obj.b;\nobj.b.obj = obj;\n\nconsole.log(inspect(obj));\n// <ref *1> {\n//   a: [ [Circular *1] ],\n//   b: <ref *2> { inner: [Circular *2], obj: [Circular *1] }\n// }"},{"language":"mjs","displayName":null,"code":"import util from 'node:util';\n\nconsole.log(util.inspect(util, { showHidden: true, depth: null }));"},{"language":"cjs","displayName":null,"code":"const util = require('node:util');\n\nconsole.log(util.inspect(util, { showHidden: true, depth: null }));"},{"language":"mjs","displayName":null,"code":"import { inspect } from 'node:util';\n\nconst o = {\n  a: [1, 2, [[\n    'Lorem ipsum dolor sit amet,\\nconsectetur adipiscing elit, sed do ' +\n      'eiusmod \\ntempor incididunt ut labore et dolore magna aliqua.',\n    'test',\n    'foo']], 4],\n  b: new Map([['za', 1], ['zb', 'test']]),\n};\nconsole.log(inspect(o, { compact: true, depth: 5, breakLength: 80 }));\n\n// { a:\n//   [ 1,\n//     2,\n//     [ [ 'Lorem ipsum dolor sit amet,\\nconsectetur [...]', // A long line\n//           'test',\n//           'foo' ] ],\n//     4 ],\n//   b: Map(2) { 'za' => 1, 'zb' => 'test' } }\n\n// Setting `compact` to false or an integer creates more reader friendly output.\nconsole.log(inspect(o, { compact: false, depth: 5, breakLength: 80 }));\n\n// {\n//   a: [\n//     1,\n//     2,\n//     [\n//       [\n//         'Lorem ipsum dolor sit amet,\\n' +\n//           'consectetur adipiscing elit, sed do eiusmod \\n' +\n//           'tempor incididunt ut labore et dolore magna aliqua.',\n//         'test',\n//         'foo'\n//       ]\n//     ],\n//     4\n//   ],\n//   b: Map(2) {\n//     'za' => 1,\n//     'zb' => 'test'\n//   }\n// }\n\n// Setting `breakLength` to e.g. 150 will print the \"Lorem ipsum\" text in a\n// single line."},{"language":"cjs","displayName":null,"code":"const { inspect } = require('node:util');\n\nconst o = {\n  a: [1, 2, [[\n    'Lorem ipsum dolor sit amet,\\nconsectetur adipiscing elit, sed do ' +\n      'eiusmod \\ntempor incididunt ut labore et dolore magna aliqua.',\n    'test',\n    'foo']], 4],\n  b: new Map([['za', 1], ['zb', 'test']]),\n};\nconsole.log(inspect(o, { compact: true, depth: 5, breakLength: 80 }));\n\n// { a:\n//   [ 1,\n//     2,\n//     [ [ 'Lorem ipsum dolor sit amet,\\nconsectetur [...]', // A long line\n//           'test',\n//           'foo' ] ],\n//     4 ],\n//   b: Map(2) { 'za' => 1, 'zb' => 'test' } }\n\n// Setting `compact` to false or an integer creates more reader friendly output.\nconsole.log(inspect(o, { compact: false, depth: 5, breakLength: 80 }));\n\n// {\n//   a: [\n//     1,\n//     2,\n//     [\n//       [\n//         'Lorem ipsum dolor sit amet,\\n' +\n//           'consectetur adipiscing elit, sed do eiusmod \\n' +\n//           'tempor incididunt ut labore et dolore magna aliqua.',\n//         'test',\n//         'foo'\n//       ]\n//     ],\n//     4\n//   ],\n//   b: Map(2) {\n//     'za' => 1,\n//     'zb' => 'test'\n//   }\n// }\n\n// Setting `breakLength` to e.g. 150 will print the \"Lorem ipsum\" text in a\n// single line."},{"language":"mjs","displayName":null,"code":"import { inspect } from 'node:util';\n\nconst obj = { a: 1 };\nconst obj2 = { b: 2 };\nconst weakSet = new WeakSet([obj, obj2]);\n\nconsole.log(inspect(weakSet, { showHidden: true }));\n// WeakSet { { a: 1 }, { b: 2 } }"},{"language":"cjs","displayName":null,"code":"const { inspect } = require('node:util');\n\nconst obj = { a: 1 };\nconst obj2 = { b: 2 };\nconst weakSet = new WeakSet([obj, obj2]);\n\nconsole.log(inspect(weakSet, { showHidden: true }));\n// WeakSet { { a: 1 }, { b: 2 } }"},{"language":"mjs","displayName":null,"code":"import { inspect } from 'node:util';\nimport assert from 'node:assert';\n\nconst o1 = {\n  b: [2, 3, 1],\n  a: '`a` comes before `b`',\n  c: new Set([2, 3, 1]),\n};\nconsole.log(inspect(o1, { sorted: true }));\n// { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } }\nconsole.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) }));\n// { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' }\n\nconst o2 = {\n  c: new Set([2, 1, 3]),\n  a: '`a` comes before `b`',\n  b: [2, 3, 1],\n};\nassert.strict.equal(\n  inspect(o1, { sorted: true }),\n  inspect(o2, { sorted: true }),\n);"},{"language":"cjs","displayName":null,"code":"const { inspect } = require('node:util');\nconst assert = require('node:assert');\n\nconst o1 = {\n  b: [2, 3, 1],\n  a: '`a` comes before `b`',\n  c: new Set([2, 3, 1]),\n};\nconsole.log(inspect(o1, { sorted: true }));\n// { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } }\nconsole.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) }));\n// { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' }\n\nconst o2 = {\n  c: new Set([2, 1, 3]),\n  a: '`a` comes before `b`',\n  b: [2, 3, 1],\n};\nassert.strict.equal(\n  inspect(o1, { sorted: true }),\n  inspect(o2, { sorted: true }),\n);"},{"language":"mjs","displayName":null,"code":"import { inspect } from 'node:util';\n\nconst thousand = 1000;\nconst million = 1000000;\nconst bigNumber = 123456789n;\nconst bigDecimal = 1234.12345;\n\nconsole.log(inspect(thousand, { numericSeparator: true }));\n// 1_000\nconsole.log(inspect(million, { numericSeparator: true }));\n// 1_000_000\nconsole.log(inspect(bigNumber, { numericSeparator: true }));\n// 123_456_789n\nconsole.log(inspect(bigDecimal, { numericSeparator: true }));\n// 1_234.123_45"},{"language":"cjs","displayName":null,"code":"const { inspect } = require('node:util');\n\nconst thousand = 1000;\nconst million = 1000000;\nconst bigNumber = 123456789n;\nconst bigDecimal = 1234.12345;\n\nconsole.log(inspect(thousand, { numericSeparator: true }));\n// 1_000\nconsole.log(inspect(million, { numericSeparator: true }));\n// 1_000_000\nconsole.log(inspect(bigNumber, { numericSeparator: true }));\n// 123_456_789n\nconsole.log(inspect(bigDecimal, { numericSeparator: true }));\n// 1_234.123_45"}],"children":[{"kind":"section","id":"customizing-utilinspect-colors","name":"Customizing util.inspect colors","title":"Customizing `util.inspect` colors","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Color output (if enabled) of `util.inspect` is customizable globally\nvia the `util.inspect.styles` and `util.inspect.colors` properties.\n\n`util.inspect.styles` is a map associating a style name to a color from\n`util.inspect.colors`.\n\nThe default styles and associated colors are:\n\n* `bigint`: `yellow`\n* `boolean`: `yellow`\n* `date`: `magenta`\n* `module`: `underline`\n* `name`: (no styling)\n* `null`: `bold`\n* `number`: `yellow`\n* `regexp`: A method that colors character classes, groups, assertions, and\n  other parts for improved readability. To customize the coloring, change the\n  `colors` property. It is set to\n  `['red', 'green', 'yellow', 'cyan', 'magenta']` by default and may be\n  adjusted as needed. The array is repetitively iterated through depending on\n  the \"depth\".\n* `special`: `cyan` (e.g., `Proxies`)\n* `string`: `green`\n* `symbol`: `green`\n* `undefined`: `grey`\n\nColor styling uses ANSI control codes that may not be supported on all\nterminals. To verify color support use [`tty.hasColors()`](tty.html#writestreamhascolorscount-env).\n\nPredefined control codes are listed below (grouped as \"Modifiers\", \"Foreground\ncolors\", and \"Background colors\").","summary":"Color output (if enabled) of `util.inspect` is customizable globally via the `util.inspect.styles` and `util.inspect.colors` properties.","examples":[],"children":[{"kind":"section","id":"complex-custom-coloring","name":"Complex custom coloring","title":"Complex custom coloring","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"It is possible to define a method as style. It receives the stringified value\nof the input. It is invoked in case coloring is active and the type is\ninspected.\n\nExample: `util.inspect.styles.regexp(value)`\n\n* `value` {string} The string representation of the input type.\n* Returns: {string} The adjusted representation of `object`.","summary":"It is possible to define a method as style. It receives the stringified value of the input. It is invoked in case coloring is active and the type is inspected.","examples":[],"children":[]},{"kind":"section","id":"modifiers","name":"Modifiers","title":"Modifiers","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Modifier support varies throughout different terminals. They will mostly be\nignored, if not supported.\n\n* `reset` - Resets all (color) modifiers to their defaults\n* **bold** - Make text bold\n* *italic* - Make text italic\n* <span style=\"border-bottom: 1px solid;\">underline</span> - Make text underlined\n* ~~strikethrough~~ - Puts a horizontal line through the center of the text\n  (Alias: `strikeThrough`, `crossedout`, `crossedOut`)\n* `hidden` - Prints the text, but makes it invisible (Alias: conceal)\n* <span style=\"opacity: 0.5;\">dim</span> - Decreased color intensity (Alias:\n  `faint`)\n* <span style=\"border-top: 1px solid;\">overlined</span> - Make text overlined\n* blink - Hides and shows the text in an interval\n* <span style=\"filter: invert(100%);\">inverse</span> - Swap foreground and\n  background colors (Alias: `swapcolors`, `swapColors`)\n* <span style=\"border-bottom: 1px double;\">doubleunderline</span> - Make text\n  double underlined (Alias: `doubleUnderline`)\n* <span style=\"border: 1px solid;\">framed</span> - Draw a frame around the text","summary":"Modifier support varies throughout different terminals. They will mostly be ignored, if not supported.","examples":[],"children":[]},{"kind":"section","id":"foreground-colors","name":"Foreground colors","title":"Foreground colors","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"* `black`\n* `red`\n* `green`\n* `yellow`\n* `blue`\n* `magenta`\n* `cyan`\n* `white`\n* `gray` (alias: `grey`, `blackBright`)\n* `redBright`\n* `greenBright`\n* `yellowBright`\n* `blueBright`\n* `magentaBright`\n* `cyanBright`\n* `whiteBright`","summary":"","examples":[],"children":[]},{"kind":"section","id":"background-colors","name":"Background colors","title":"Background colors","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"* `bgBlack`\n* `bgRed`\n* `bgGreen`\n* `bgYellow`\n* `bgBlue`\n* `bgMagenta`\n* `bgCyan`\n* `bgWhite`\n* `bgGray` (alias: `bgGrey`, `bgBlackBright`)\n* `bgRedBright`\n* `bgGreenBright`\n* `bgYellowBright`\n* `bgBlueBright`\n* `bgMagentaBright`\n* `bgCyanBright`\n* `bgWhiteBright`","summary":"","examples":[],"children":[]}]},{"kind":"section","id":"custom-inspection-functions-on-objects","name":"Custom inspection functions on objects","title":"Custom inspection functions on objects","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.97"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v17.3.0","v16.14.0"],"prUrl":"https://github.com/nodejs/node/pull/41019","commit":null,"description":"The inspect argument is added for more interoperability."}],"description":"Objects may also define their own\n[`[util.inspect.custom](depth, opts, inspect)`](#utilinspectcustom) function,\nwhich `util.inspect()` will invoke and use the result of when inspecting\nthe object.\n\n```mjs\nimport { inspect } from 'node:util';\n\nclass Box {\n  constructor(value) {\n    this.value = value;\n  }\n\n  [inspect.custom](depth, options, inspect) {\n    if (depth < 0) {\n      return options.stylize('[Box]', 'special');\n    }\n\n    const newOptions = Object.assign({}, options, {\n      depth: options.depth === null ? null : options.depth - 1,\n    });\n\n    // Five space padding because that's the size of \"Box< \".\n    const padding = ' '.repeat(5);\n    const inner = inspect(this.value, newOptions)\n                  .replace(/\\n/g, `\\n${padding}`);\n    return `${options.stylize('Box', 'special')}< ${inner} >`;\n  }\n}\n\nconst box = new Box(true);\n\nconsole.log(inspect(box));\n// \"Box< true >\"\n```\n\n```cjs\nconst { inspect } = require('node:util');\n\nclass Box {\n  constructor(value) {\n    this.value = value;\n  }\n\n  [inspect.custom](depth, options, inspect) {\n    if (depth < 0) {\n      return options.stylize('[Box]', 'special');\n    }\n\n    const newOptions = Object.assign({}, options, {\n      depth: options.depth === null ? null : options.depth - 1,\n    });\n\n    // Five space padding because that's the size of \"Box< \".\n    const padding = ' '.repeat(5);\n    const inner = inspect(this.value, newOptions)\n                  .replace(/\\n/g, `\\n${padding}`);\n    return `${options.stylize('Box', 'special')}< ${inner} >`;\n  }\n}\n\nconst box = new Box(true);\n\nconsole.log(inspect(box));\n// \"Box< true >\"\n```\n\nCustom `[util.inspect.custom](depth, opts, inspect)` functions typically return\na string but may return a value of any type that will be formatted accordingly\nby `util.inspect()`.\n\n```mjs\nimport { inspect } from 'node:util';\n\nconst obj = { foo: 'this will not show up in the inspect() output' };\nobj[inspect.custom] = (depth) => {\n  return { bar: 'baz' };\n};\n\nconsole.log(inspect(obj));\n// \"{ bar: 'baz' }\"\n```\n\n```cjs\nconst { inspect } = require('node:util');\n\nconst obj = { foo: 'this will not show up in the inspect() output' };\nobj[inspect.custom] = (depth) => {\n  return { bar: 'baz' };\n};\n\nconsole.log(inspect(obj));\n// \"{ bar: 'baz' }\"\n```","summary":"Objects may also define their own `[util.inspect.custom](depth, opts, inspect)` function, which `util.inspect()` will invoke and use the result of when inspecting the object.","examples":[{"language":"mjs","displayName":null,"code":"import { inspect } from 'node:util';\n\nclass Box {\n  constructor(value) {\n    this.value = value;\n  }\n\n  [inspect.custom](depth, options, inspect) {\n    if (depth < 0) {\n      return options.stylize('[Box]', 'special');\n    }\n\n    const newOptions = Object.assign({}, options, {\n      depth: options.depth === null ? null : options.depth - 1,\n    });\n\n    // Five space padding because that's the size of \"Box< \".\n    const padding = ' '.repeat(5);\n    const inner = inspect(this.value, newOptions)\n                  .replace(/\\n/g, `\\n${padding}`);\n    return `${options.stylize('Box', 'special')}< ${inner} >`;\n  }\n}\n\nconst box = new Box(true);\n\nconsole.log(inspect(box));\n// \"Box< true >\""},{"language":"cjs","displayName":null,"code":"const { inspect } = require('node:util');\n\nclass Box {\n  constructor(value) {\n    this.value = value;\n  }\n\n  [inspect.custom](depth, options, inspect) {\n    if (depth < 0) {\n      return options.stylize('[Box]', 'special');\n    }\n\n    const newOptions = Object.assign({}, options, {\n      depth: options.depth === null ? null : options.depth - 1,\n    });\n\n    // Five space padding because that's the size of \"Box< \".\n    const padding = ' '.repeat(5);\n    const inner = inspect(this.value, newOptions)\n                  .replace(/\\n/g, `\\n${padding}`);\n    return `${options.stylize('Box', 'special')}< ${inner} >`;\n  }\n}\n\nconst box = new Box(true);\n\nconsole.log(inspect(box));\n// \"Box< true >\""},{"language":"mjs","displayName":null,"code":"import { inspect } from 'node:util';\n\nconst obj = { foo: 'this will not show up in the inspect() output' };\nobj[inspect.custom] = (depth) => {\n  return { bar: 'baz' };\n};\n\nconsole.log(inspect(obj));\n// \"{ bar: 'baz' }\""},{"language":"cjs","displayName":null,"code":"const { inspect } = require('node:util');\n\nconst obj = { foo: 'this will not show up in the inspect() output' };\nobj[inspect.custom] = (depth) => {\n  return { bar: 'baz' };\n};\n\nconsole.log(inspect(obj));\n// \"{ bar: 'baz' }\""}],"children":[]},{"kind":"property","id":"utilinspectcustom","name":"custom","title":"`util.inspect.custom`","scope":"module","overloadOf":null,"stability":null,"added":["v6.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v10.12.0"],"prUrl":"https://github.com/nodejs/node/pull/20857","commit":null,"description":"This is now defined as a shared symbol."}],"type":{"text":"symbol","links":[{"name":"symbol","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type","start":0,"end":6}]},"default":null,"description":"that can be used to declare custom inspect functions.\n\nIn addition to being accessible through `util.inspect.custom`, this\nsymbol is [registered globally](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/for) and can be\naccessed in any environment as `Symbol.for('nodejs.util.inspect.custom')`.\n\nUsing this allows code to be written in a portable fashion, so that the custom\ninspect function is used in a Node.js environment and ignored in the browser.\nThe `util.inspect()` function itself is passed as third argument to the custom\ninspect function to allow further portability.\n\n```js\nconst customInspectSymbol = Symbol.for('nodejs.util.inspect.custom');\n\nclass Password {\n  constructor(value) {\n    this.value = value;\n  }\n\n  toString() {\n    return 'xxxxxxxx';\n  }\n\n  [customInspectSymbol](depth, inspectOptions, inspect) {\n    return `Password <${this.toString()}>`;\n  }\n}\n\nconst password = new Password('r0sebud');\nconsole.log(password);\n// Prints Password <xxxxxxxx>\n```\n\nSee [Custom inspection functions on Objects](#custom-inspection-functions-on-objects) for more details.","summary":"In addition to being accessible through `util.inspect.custom`, this symbol is registered globally and can be accessed in any environment as `Symbol.for('nodejs.util.inspect.custom')`.","examples":[{"language":"js","displayName":null,"code":"const customInspectSymbol = Symbol.for('nodejs.util.inspect.custom');\n\nclass Password {\n  constructor(value) {\n    this.value = value;\n  }\n\n  toString() {\n    return 'xxxxxxxx';\n  }\n\n  [customInspectSymbol](depth, inspectOptions, inspect) {\n    return `Password <${this.toString()}>`;\n  }\n}\n\nconst password = new Password('r0sebud');\nconsole.log(password);\n// Prints Password <xxxxxxxx>"}],"children":[]},{"kind":"property","id":"utilinspectdefaultoptions","name":"defaultOptions","title":"`util.inspect.defaultOptions`","scope":"module","overloadOf":null,"stability":null,"added":["v6.4.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":null,"default":null,"description":"The `defaultOptions` value allows customization of the default options used by\n`util.inspect`. This is useful for functions like `console.log` or\n`util.format` which implicitly call into `util.inspect`. It shall be set to an\nobject containing one or more valid [`util.inspect()`](#utilinspectobject-options) options. Setting\noption properties directly is also supported.\n\n```mjs\nimport { inspect } from 'node:util';\nconst arr = Array(156).fill(0);\n\nconsole.log(arr); // Logs the truncated array\ninspect.defaultOptions.maxArrayLength = null;\nconsole.log(arr); // logs the full array\n```\n\n```cjs\nconst { inspect } = require('node:util');\nconst arr = Array(156).fill(0);\n\nconsole.log(arr); // Logs the truncated array\ninspect.defaultOptions.maxArrayLength = null;\nconsole.log(arr); // logs the full array\n```","summary":"The `defaultOptions` value allows customization of the default options used by `util.inspect`. This is useful for functions like `console.log` or `util.format` which implicitly call into `util.inspect`. It shall be set to an object containing one or more valid `util.inspect()` options. Setting option properties directly is also supported.","examples":[{"language":"mjs","displayName":null,"code":"import { inspect } from 'node:util';\nconst arr = Array(156).fill(0);\n\nconsole.log(arr); // Logs the truncated array\ninspect.defaultOptions.maxArrayLength = null;\nconsole.log(arr); // logs the full array"},{"language":"cjs","displayName":null,"code":"const { inspect } = require('node:util');\nconst arr = Array(156).fill(0);\n\nconsole.log(arr); // Logs the truncated array\ninspect.defaultOptions.maxArrayLength = null;\nconsole.log(arr); // logs the full array"}],"children":[]}]},{"kind":"method","id":"utilisdeepstrictequalval1-val2-options","name":"isDeepStrictEqual","title":"`util.isDeepStrictEqual(val1, val2[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v9.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v24.9.0"],"prUrl":"https://github.com/nodejs/node/pull/59762","commit":null,"description":"Added `options` parameter to allow skipping prototype comparison."}],"signature":{"parameters":[{"name":"val1","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"val2","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if there is deep strict equality between `val1` and `val2`.\nOtherwise, returns `false`.\n\nBy default, deep strict equality includes comparison of object prototypes and\nconstructors. When `skipPrototype` is `true`, objects with\ndifferent prototypes or constructors can still be considered equal if their\nenumerable properties are deeply strictly equal.\n\n```js\nconst util = require('node:util');\n\nclass Foo {\n  constructor(a) {\n    this.a = a;\n  }\n}\n\nclass Bar {\n  constructor(a) {\n    this.a = a;\n  }\n}\n\nconst foo = new Foo(1);\nconst bar = new Bar(1);\n\n// Different constructors, same properties\nconsole.log(util.isDeepStrictEqual(foo, bar));\n// false\n\nconsole.log(util.isDeepStrictEqual(foo, bar, true));\n// true\n```\n\nSee [`assert.deepStrictEqual()`](assert.html#assertdeepstrictequalactual-expected-message) for more information about deep strict\nequality.","summary":"Returns `true` if there is deep strict equality between `val1` and `val2`. Otherwise, returns `false`.","examples":[{"language":"js","displayName":null,"code":"const util = require('node:util');\n\nclass Foo {\n  constructor(a) {\n    this.a = a;\n  }\n}\n\nclass Bar {\n  constructor(a) {\n    this.a = a;\n  }\n}\n\nconst foo = new Foo(1);\nconst bar = new Bar(1);\n\n// Different constructors, same properties\nconsole.log(util.isDeepStrictEqual(foo, bar));\n// false\n\nconsole.log(util.isDeepStrictEqual(foo, bar, true));\n// true"}],"children":[]},{"kind":"class","id":"class-utilmimetype","name":"MIMEType","title":"Class: `util.MIMEType`","scope":"module","overloadOf":null,"stability":null,"added":["v19.1.0","v18.13.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v23.11.0","v22.15.0"],"prUrl":"https://github.com/nodejs/node/pull/57510","commit":null,"description":"Marking the API stable."}],"extends":null,"description":"An implementation of [the MIMEType class](https://bmeck.github.io/node-proposal-mime-api/).\n\nIn accordance with browser conventions, all properties of `MIMEType` objects\nare implemented as getters and setters on the class prototype, rather than as\ndata properties on the object itself.\n\nA MIME string is a structured string containing multiple meaningful\ncomponents. When parsed, a `MIMEType` object is returned containing\nproperties for each of these components.","summary":"An implementation of the MIMEType class.","examples":[],"children":[{"kind":"constructor","id":"new-mimetypeinput","name":"MIMEType","title":"`new MIMEType(input)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"input","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The input MIME to parse","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Creates a new `MIMEType` object by parsing the `input`.\n\n```mjs\nimport { MIMEType } from 'node:util';\n\nconst myMIME = new MIMEType('text/plain');\n```\n\n```cjs\nconst { MIMEType } = require('node:util');\n\nconst myMIME = new MIMEType('text/plain');\n```\n\nA `TypeError` will be thrown if the `input` is not a valid MIME. Note\nthat an effort will be made to coerce the given values into strings. For\ninstance:\n\n```mjs\nimport { MIMEType } from 'node:util';\nconst myMIME = new MIMEType({ toString: () => 'text/plain' });\nconsole.log(String(myMIME));\n// Prints: text/plain\n```\n\n```cjs\nconst { MIMEType } = require('node:util');\nconst myMIME = new MIMEType({ toString: () => 'text/plain' });\nconsole.log(String(myMIME));\n// Prints: text/plain\n```","summary":"Creates a new `MIMEType` object by parsing the `input`.","examples":[{"language":"mjs","displayName":null,"code":"import { MIMEType } from 'node:util';\n\nconst myMIME = new MIMEType('text/plain');"},{"language":"cjs","displayName":null,"code":"const { MIMEType } = require('node:util');\n\nconst myMIME = new MIMEType('text/plain');"},{"language":"mjs","displayName":null,"code":"import { MIMEType } from 'node:util';\nconst myMIME = new MIMEType({ toString: () => 'text/plain' });\nconsole.log(String(myMIME));\n// Prints: text/plain"},{"language":"cjs","displayName":null,"code":"const { MIMEType } = require('node:util');\nconst myMIME = new MIMEType({ toString: () => 'text/plain' });\nconsole.log(String(myMIME));\n// Prints: text/plain"}],"children":[]},{"kind":"property","id":"mimetype","name":"type","title":"`mime.type`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"Gets and sets the type portion of the MIME.\n\n```mjs\nimport { MIMEType } from 'node:util';\n\nconst myMIME = new MIMEType('text/javascript');\nconsole.log(myMIME.type);\n// Prints: text\nmyMIME.type = 'application';\nconsole.log(myMIME.type);\n// Prints: application\nconsole.log(String(myMIME));\n// Prints: application/javascript\n```\n\n```cjs\nconst { MIMEType } = require('node:util');\n\nconst myMIME = new MIMEType('text/javascript');\nconsole.log(myMIME.type);\n// Prints: text\nmyMIME.type = 'application';\nconsole.log(myMIME.type);\n// Prints: application\nconsole.log(String(myMIME));\n// Prints: application/javascript\n```","summary":"Gets and sets the type portion of the MIME.","examples":[{"language":"mjs","displayName":null,"code":"import { MIMEType } from 'node:util';\n\nconst myMIME = new MIMEType('text/javascript');\nconsole.log(myMIME.type);\n// Prints: text\nmyMIME.type = 'application';\nconsole.log(myMIME.type);\n// Prints: application\nconsole.log(String(myMIME));\n// Prints: application/javascript"},{"language":"cjs","displayName":null,"code":"const { MIMEType } = require('node:util');\n\nconst myMIME = new MIMEType('text/javascript');\nconsole.log(myMIME.type);\n// Prints: text\nmyMIME.type = 'application';\nconsole.log(myMIME.type);\n// Prints: application\nconsole.log(String(myMIME));\n// Prints: application/javascript"}],"children":[]},{"kind":"property","id":"mimesubtype","name":"subtype","title":"`mime.subtype`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"Gets and sets the subtype portion of the MIME.\n\n```mjs\nimport { MIMEType } from 'node:util';\n\nconst myMIME = new MIMEType('text/ecmascript');\nconsole.log(myMIME.subtype);\n// Prints: ecmascript\nmyMIME.subtype = 'javascript';\nconsole.log(myMIME.subtype);\n// Prints: javascript\nconsole.log(String(myMIME));\n// Prints: text/javascript\n```\n\n```cjs\nconst { MIMEType } = require('node:util');\n\nconst myMIME = new MIMEType('text/ecmascript');\nconsole.log(myMIME.subtype);\n// Prints: ecmascript\nmyMIME.subtype = 'javascript';\nconsole.log(myMIME.subtype);\n// Prints: javascript\nconsole.log(String(myMIME));\n// Prints: text/javascript\n```","summary":"Gets and sets the subtype portion of the MIME.","examples":[{"language":"mjs","displayName":null,"code":"import { MIMEType } from 'node:util';\n\nconst myMIME = new MIMEType('text/ecmascript');\nconsole.log(myMIME.subtype);\n// Prints: ecmascript\nmyMIME.subtype = 'javascript';\nconsole.log(myMIME.subtype);\n// Prints: javascript\nconsole.log(String(myMIME));\n// Prints: text/javascript"},{"language":"cjs","displayName":null,"code":"const { MIMEType } = require('node:util');\n\nconst myMIME = new MIMEType('text/ecmascript');\nconsole.log(myMIME.subtype);\n// Prints: ecmascript\nmyMIME.subtype = 'javascript';\nconsole.log(myMIME.subtype);\n// Prints: javascript\nconsole.log(String(myMIME));\n// Prints: text/javascript"}],"children":[]},{"kind":"property","id":"mimeessence","name":"essence","title":"`mime.essence`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"Gets the essence of the MIME. This property is read only.\nUse `mime.type` or `mime.subtype` to alter the MIME.\n\n```mjs\nimport { MIMEType } from 'node:util';\n\nconst myMIME = new MIMEType('text/javascript;key=value');\nconsole.log(myMIME.essence);\n// Prints: text/javascript\nmyMIME.type = 'application';\nconsole.log(myMIME.essence);\n// Prints: application/javascript\nconsole.log(String(myMIME));\n// Prints: application/javascript;key=value\n```\n\n```cjs\nconst { MIMEType } = require('node:util');\n\nconst myMIME = new MIMEType('text/javascript;key=value');\nconsole.log(myMIME.essence);\n// Prints: text/javascript\nmyMIME.type = 'application';\nconsole.log(myMIME.essence);\n// Prints: application/javascript\nconsole.log(String(myMIME));\n// Prints: application/javascript;key=value\n```","summary":"Gets the essence of the MIME. This property is read only. Use `mime.type` or `mime.subtype` to alter the MIME.","examples":[{"language":"mjs","displayName":null,"code":"import { MIMEType } from 'node:util';\n\nconst myMIME = new MIMEType('text/javascript;key=value');\nconsole.log(myMIME.essence);\n// Prints: text/javascript\nmyMIME.type = 'application';\nconsole.log(myMIME.essence);\n// Prints: application/javascript\nconsole.log(String(myMIME));\n// Prints: application/javascript;key=value"},{"language":"cjs","displayName":null,"code":"const { MIMEType } = require('node:util');\n\nconst myMIME = new MIMEType('text/javascript;key=value');\nconsole.log(myMIME.essence);\n// Prints: text/javascript\nmyMIME.type = 'application';\nconsole.log(myMIME.essence);\n// Prints: application/javascript\nconsole.log(String(myMIME));\n// Prints: application/javascript;key=value"}],"children":[]},{"kind":"property","id":"mimeparams","name":"params","title":"`mime.params`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"MIMEParams","links":[{"name":"MIMEParams","href":"util.html#class-utilmimeparams","start":0,"end":10}]},"default":null,"description":"Gets the [`MIMEParams`](#class-utilmimeparams) object representing the\nparameters of the MIME. This property is read-only. See\n[`MIMEParams`](#class-utilmimeparams) documentation for details.","summary":"Gets the `MIMEParams` object representing the parameters of the MIME. This property is read-only. See `MIMEParams` documentation for details.","examples":[],"children":[]},{"kind":"method","id":"mimetostring","name":"toString","title":"`mime.toString()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":""}},"description":"The `toString()` method on the `MIMEType` object returns the serialized MIME.\n\nBecause of the need for standard compliance, this method does not allow users\nto customize the serialization process of the MIME.","summary":"The `toString()` method on the `MIMEType` object returns the serialized MIME.","examples":[],"children":[]},{"kind":"method","id":"mimetojson","name":"toJSON","title":"`mime.toJSON()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":""}},"description":"Alias for [`mime.toString()`](#mimetostring).\n\nThis method is automatically called when an `MIMEType` object is serialized\nwith [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify).\n\n```mjs\nimport { MIMEType } from 'node:util';\n\nconst myMIMES = [\n  new MIMEType('image/png'),\n  new MIMEType('image/gif'),\n];\nconsole.log(JSON.stringify(myMIMES));\n// Prints: [\"image/png\", \"image/gif\"]\n```\n\n```cjs\nconst { MIMEType } = require('node:util');\n\nconst myMIMES = [\n  new MIMEType('image/png'),\n  new MIMEType('image/gif'),\n];\nconsole.log(JSON.stringify(myMIMES));\n// Prints: [\"image/png\", \"image/gif\"]\n```","summary":"Alias for `mime.toString()`.","examples":[{"language":"mjs","displayName":null,"code":"import { MIMEType } from 'node:util';\n\nconst myMIMES = [\n  new MIMEType('image/png'),\n  new MIMEType('image/gif'),\n];\nconsole.log(JSON.stringify(myMIMES));\n// Prints: [\"image/png\", \"image/gif\"]"},{"language":"cjs","displayName":null,"code":"const { MIMEType } = require('node:util');\n\nconst myMIMES = [\n  new MIMEType('image/png'),\n  new MIMEType('image/gif'),\n];\nconsole.log(JSON.stringify(myMIMES));\n// Prints: [\"image/png\", \"image/gif\"]"}],"children":[]},{"kind":"method","id":"mimetypeparsestring","name":"parse","title":"`MIMEType.parse(string)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"string","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The input MIME to parse","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"MIMEType | null","links":[{"name":"MIMEType","href":"https://developer.mozilla.org/docs/Web/API/MimeType","start":0,"end":8},{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":11,"end":15}]},"description":""}},"description":"<!--\nadded: v26.8.0\n-->\n\nAttempts to parse the given `string` as a MIMEType. If the string cannot be\nparsed, `null` is returned.","summary":"Attempts to parse the given `string` as a MIMEType. If the string cannot be parsed, `null` is returned.","examples":[],"children":[]}]},{"kind":"class","id":"class-utilmimeparams","name":"MIMEParams","title":"Class: `util.MIMEParams`","scope":"module","overloadOf":null,"stability":null,"added":["v19.1.0","v18.13.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"The `MIMEParams` API provides read and write access to the parameters of a\n`MIMEType`.","summary":"The `MIMEParams` API provides read and write access to the parameters of a `MIMEType`.","examples":[],"children":[{"kind":"constructor","id":"new-mimeparams","name":"MIMEParams","title":"`new MIMEParams()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Creates a new `MIMEParams` object by with empty parameters\n\n```mjs\nimport { MIMEParams } from 'node:util';\n\nconst myParams = new MIMEParams();\n```\n\n```cjs\nconst { MIMEParams } = require('node:util');\n\nconst myParams = new MIMEParams();\n```","summary":"Creates a new `MIMEParams` object by with empty parameters","examples":[{"language":"mjs","displayName":null,"code":"import { MIMEParams } from 'node:util';\n\nconst myParams = new MIMEParams();"},{"language":"cjs","displayName":null,"code":"const { MIMEParams } = require('node:util');\n\nconst myParams = new MIMEParams();"}],"children":[]},{"kind":"method","id":"mimeparamsdeletename","name":"delete","title":"`mimeParams.delete(name)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Remove all name-value pairs whose name is `name`.","summary":"Remove all name-value pairs whose name is `name`.","examples":[],"children":[]},{"kind":"method","id":"mimeparamsentries","name":"entries","title":"`mimeParams.entries()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":""}},"description":"Returns an iterator over each of the name-value pairs in the parameters.\nEach item of the iterator is a JavaScript `Array`. The first item of the array\nis the `name`, the second item of the array is the `value`.","summary":"Returns an iterator over each of the name-value pairs in the parameters. Each item of the iterator is a JavaScript `Array`. The first item of the array is the `name`, the second item of the array is the `value`.","examples":[],"children":[]},{"kind":"method","id":"mimeparamsgetname","name":"get","title":"`mimeParams.get(name)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"string | null","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"null","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type","start":9,"end":13}]},"description":"A string or `null` if there is no name-value pair\nwith the given `name`."}},"description":"Returns the value of the first name-value pair whose name is `name`. If there\nare no such pairs, `null` is returned.","summary":"Returns the value of the first name-value pair whose name is `name`. If there are no such pairs, `null` is returned.","examples":[],"children":[]},{"kind":"method","id":"mimeparamshasname","name":"has","title":"`mimeParams.has(name)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if there is at least one name-value pair whose name is `name`.","summary":"Returns `true` if there is at least one name-value pair whose name is `name`.","examples":[],"children":[]},{"kind":"method","id":"mimeparamskeys","name":"keys","title":"`mimeParams.keys()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":""}},"description":"Returns an iterator over the names of each name-value pair.\n\n```mjs\nimport { MIMEType } from 'node:util';\n\nconst { params } = new MIMEType('text/plain;foo=0;bar=1');\nfor (const name of params.keys()) {\n  console.log(name);\n}\n// Prints:\n//   foo\n//   bar\n```\n\n```cjs\nconst { MIMEType } = require('node:util');\n\nconst { params } = new MIMEType('text/plain;foo=0;bar=1');\nfor (const name of params.keys()) {\n  console.log(name);\n}\n// Prints:\n//   foo\n//   bar\n```","summary":"Returns an iterator over the names of each name-value pair.","examples":[{"language":"mjs","displayName":null,"code":"import { MIMEType } from 'node:util';\n\nconst { params } = new MIMEType('text/plain;foo=0;bar=1');\nfor (const name of params.keys()) {\n  console.log(name);\n}\n// Prints:\n//   foo\n//   bar"},{"language":"cjs","displayName":null,"code":"const { MIMEType } = require('node:util');\n\nconst { params } = new MIMEType('text/plain;foo=0;bar=1');\nfor (const name of params.keys()) {\n  console.log(name);\n}\n// Prints:\n//   foo\n//   bar"}],"children":[]},{"kind":"method","id":"mimeparamssetname-value","name":"set","title":"`mimeParams.set(name, value)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"value","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Sets the value in the `MIMEParams` object associated with `name` to\n`value`. If there are any pre-existing name-value pairs whose names are `name`,\nset the first such pair's value to `value`.\n\n```mjs\nimport { MIMEType } from 'node:util';\n\nconst { params } = new MIMEType('text/plain;foo=0;bar=1');\nparams.set('foo', 'def');\nparams.set('baz', 'xyz');\nconsole.log(params.toString());\n// Prints: foo=def;bar=1;baz=xyz\n```\n\n```cjs\nconst { MIMEType } = require('node:util');\n\nconst { params } = new MIMEType('text/plain;foo=0;bar=1');\nparams.set('foo', 'def');\nparams.set('baz', 'xyz');\nconsole.log(params.toString());\n// Prints: foo=def;bar=1;baz=xyz\n```","summary":"Sets the value in the `MIMEParams` object associated with `name` to `value`. If there are any pre-existing name-value pairs whose names are `name`, set the first such pair's value to `value`.","examples":[{"language":"mjs","displayName":null,"code":"import { MIMEType } from 'node:util';\n\nconst { params } = new MIMEType('text/plain;foo=0;bar=1');\nparams.set('foo', 'def');\nparams.set('baz', 'xyz');\nconsole.log(params.toString());\n// Prints: foo=def;bar=1;baz=xyz"},{"language":"cjs","displayName":null,"code":"const { MIMEType } = require('node:util');\n\nconst { params } = new MIMEType('text/plain;foo=0;bar=1');\nparams.set('foo', 'def');\nparams.set('baz', 'xyz');\nconsole.log(params.toString());\n// Prints: foo=def;bar=1;baz=xyz"}],"children":[]},{"kind":"method","id":"mimeparamsvalues","name":"values","title":"`mimeParams.values()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":""}},"description":"Returns an iterator over the values of each name-value pair.","summary":"Returns an iterator over the values of each name-value pair.","examples":[],"children":[]},{"kind":"method","id":"mimeparamssymboliterator","name":"[Symbol.iterator]","title":"`mimeParams[Symbol.iterator]()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Iterator","links":[{"name":"Iterator","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Iterator","start":0,"end":8}]},"description":""}},"description":"Alias for [`mimeParams.entries()`](#mimeparamsentries).\n\n```mjs\nimport { MIMEType } from 'node:util';\n\nconst { params } = new MIMEType('text/plain;foo=bar;xyz=baz');\nfor (const [name, value] of params) {\n  console.log(name, value);\n}\n// Prints:\n//   foo bar\n//   xyz baz\n```\n\n```cjs\nconst { MIMEType } = require('node:util');\n\nconst { params } = new MIMEType('text/plain;foo=bar;xyz=baz');\nfor (const [name, value] of params) {\n  console.log(name, value);\n}\n// Prints:\n//   foo bar\n//   xyz baz\n```","summary":"Alias for `mimeParams.entries()`.","examples":[{"language":"mjs","displayName":null,"code":"import { MIMEType } from 'node:util';\n\nconst { params } = new MIMEType('text/plain;foo=bar;xyz=baz');\nfor (const [name, value] of params) {\n  console.log(name, value);\n}\n// Prints:\n//   foo bar\n//   xyz baz"},{"language":"cjs","displayName":null,"code":"const { MIMEType } = require('node:util');\n\nconst { params } = new MIMEType('text/plain;foo=bar;xyz=baz');\nfor (const [name, value] of params) {\n  console.log(name, value);\n}\n// Prints:\n//   foo bar\n//   xyz baz"}],"children":[]}]},{"kind":"method","id":"utilparseargsconfig","name":"parseArgs","title":"`util.parseArgs([config])`","scope":"module","overloadOf":null,"stability":null,"added":["v18.3.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v22.4.0","v20.16.0"],"prUrl":"https://github.com/nodejs/node/pull/53107","commit":null,"description":"add support for allowing negative options in input `config`."},{"versions":["v20.0.0"],"prUrl":"https://github.com/nodejs/node/pull/46718","commit":null,"description":"The API is no longer experimental."},{"versions":["v18.11.0","v16.19.0"],"prUrl":"https://github.com/nodejs/node/pull/44631","commit":null,"description":"Add support for default values in input `config`."},{"versions":["v18.7.0","v16.17.0"],"prUrl":"https://github.com/nodejs/node/pull/43459","commit":null,"description":"add support for returning detailed parse information using `tokens` in input `config` and returned properties."}],"signature":{"parameters":[{"name":"config","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Used to provide arguments for parsing and to configure\nthe parser. `config` supports the following properties:","default":null,"optional":true,"rest":false,"properties":[{"name":"args","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"array of argument strings.","default":"`process.argv` with `execPath` and `filename` removed","optional":true,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Used to describe arguments known to the parser.\nKeys of `options` are the long names of options and values are an\n{Object} accepting the following properties:","default":null,"optional":false,"rest":false,"properties":[{"name":"type","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Type of argument, which must be either `boolean` or `string`.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"multiple","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Whether this option can be provided multiple\ntimes. If `true`, all values will be collected in an array. If\n`false`, values for the option are last-wins.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"short","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A single character alias for the option.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"default","type":{"text":"string | boolean | string[] | boolean[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":9,"end":16},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":19,"end":25},{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":30,"end":37}]},"description":"The value to assign to\nthe option if it does not appear in the arguments to be parsed. The value\nmust match the type specified by the `type` property. If `multiple` is\n`true`, it must be an array. No default value is applied when the option\ndoes appear in the arguments to be parsed, even if the provided value\nis falsy.","default":null,"optional":false,"rest":false,"properties":[]}]},{"name":"strict","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Should an error be thrown when unknown arguments\nare encountered, or when arguments are passed that do not match the\n`type` configured in `options`.","default":"true","optional":true,"rest":false,"properties":[]},{"name":"allowPositionals","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Whether this command accepts positional\narguments.","default":"false` if `strict` is `true`, otherwise `true","optional":true,"rest":false,"properties":[]},{"name":"allowNegative","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If `true`, allows explicitly setting boolean\noptions to `false` by prefixing the option name with `--no-`.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"tokens","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Return the parsed tokens. This is useful for extending\nthe built-in behavior, from adding additional checks through to reprocessing\nthe tokens in different ways.","default":"false","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"The parsed command line arguments:"}},"description":"Provides a higher level API for command-line argument parsing than interacting\nwith `process.argv` directly. Takes a specification for the expected arguments\nand returns a structured object with the parsed options and positionals.\n\n```mjs\nimport { parseArgs } from 'node:util';\nconst args = ['-f', '--bar', 'b'];\nconst options = {\n  foo: {\n    type: 'boolean',\n    short: 'f',\n  },\n  bar: {\n    type: 'string',\n  },\n};\nconst {\n  values,\n  positionals,\n} = parseArgs({ args, options });\nconsole.log(values, positionals);\n// Prints: [Object: null prototype] { foo: true, bar: 'b' } []\n```\n\n```cjs\nconst { parseArgs } = require('node:util');\nconst args = ['-f', '--bar', 'b'];\nconst options = {\n  foo: {\n    type: 'boolean',\n    short: 'f',\n  },\n  bar: {\n    type: 'string',\n  },\n};\nconst {\n  values,\n  positionals,\n} = parseArgs({ args, options });\nconsole.log(values, positionals);\n// Prints: [Object: null prototype] { foo: true, bar: 'b' } []\n```","summary":"Provides a higher level API for command-line argument parsing than interacting with `process.argv` directly. Takes a specification for the expected arguments and returns a structured object with the parsed options and positionals.","examples":[{"language":"mjs","displayName":null,"code":"import { parseArgs } from 'node:util';\nconst args = ['-f', '--bar', 'b'];\nconst options = {\n  foo: {\n    type: 'boolean',\n    short: 'f',\n  },\n  bar: {\n    type: 'string',\n  },\n};\nconst {\n  values,\n  positionals,\n} = parseArgs({ args, options });\nconsole.log(values, positionals);\n// Prints: [Object: null prototype] { foo: true, bar: 'b' } []"},{"language":"cjs","displayName":null,"code":"const { parseArgs } = require('node:util');\nconst args = ['-f', '--bar', 'b'];\nconst options = {\n  foo: {\n    type: 'boolean',\n    short: 'f',\n  },\n  bar: {\n    type: 'string',\n  },\n};\nconst {\n  values,\n  positionals,\n} = parseArgs({ args, options });\nconsole.log(values, positionals);\n// Prints: [Object: null prototype] { foo: true, bar: 'b' } []"}],"children":[{"kind":"section","id":"parseargs-tokens","name":"parseArgs tokens","title":"`parseArgs` `tokens`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Detailed parse information is available for adding custom behaviors by\nspecifying `tokens: true` in the configuration.\nThe returned tokens have properties describing:\n\n* all tokens\n  * `kind` {string} One of 'option', 'positional', or 'option-terminator'.\n  * `index` {number} Index of element in `args` containing token. So the\n    source argument for a token is `args[token.index]`.\n* option tokens\n  * `name` {string} Long name of option.\n  * `rawName` {string} How option used in args, like `-f` of `--foo`.\n  * `value` {string | undefined} Option value specified in args.\n    Undefined for boolean options.\n  * `inlineValue` {boolean | undefined} Whether option value specified inline,\n    like `--foo=bar`.\n* positional tokens\n  * `value` {string} The value of the positional argument in args (i.e. `args[index]`).\n* option-terminator token\n\nThe returned tokens are in the order encountered in the input args. Options\nthat appear more than once in args produce a token for each use. Short option\ngroups like `-xy` expand to a token for each option. So `-xxx` produces\nthree tokens.\n\nFor example, to add support for a negated option like `--no-color` (which\n`allowNegative` supports when the option is of `boolean` type), the returned\ntokens can be reprocessed to change the value stored for the negated option.\n\n```mjs\nimport { parseArgs } from 'node:util';\n\nconst options = {\n  'color': { type: 'boolean' },\n  'no-color': { type: 'boolean' },\n  'logfile': { type: 'string' },\n  'no-logfile': { type: 'boolean' },\n};\nconst { values, tokens } = parseArgs({ options, tokens: true });\n\n// Reprocess the option tokens and overwrite the returned values.\ntokens\n  .filter((token) => token.kind === 'option')\n  .forEach((token) => {\n    if (token.name.startsWith('no-')) {\n      // Store foo:false for --no-foo\n      const positiveName = token.name.slice(3);\n      values[positiveName] = false;\n      delete values[token.name];\n    } else {\n      // Resave value so last one wins if both --foo and --no-foo.\n      values[token.name] = token.value ?? true;\n    }\n  });\n\nconst color = values.color;\nconst logfile = values.logfile ?? 'default.log';\n\nconsole.log({ logfile, color });\n```\n\n```cjs\nconst { parseArgs } = require('node:util');\n\nconst options = {\n  'color': { type: 'boolean' },\n  'no-color': { type: 'boolean' },\n  'logfile': { type: 'string' },\n  'no-logfile': { type: 'boolean' },\n};\nconst { values, tokens } = parseArgs({ options, tokens: true });\n\n// Reprocess the option tokens and overwrite the returned values.\ntokens\n  .filter((token) => token.kind === 'option')\n  .forEach((token) => {\n    if (token.name.startsWith('no-')) {\n      // Store foo:false for --no-foo\n      const positiveName = token.name.slice(3);\n      values[positiveName] = false;\n      delete values[token.name];\n    } else {\n      // Resave value so last one wins if both --foo and --no-foo.\n      values[token.name] = token.value ?? true;\n    }\n  });\n\nconst color = values.color;\nconst logfile = values.logfile ?? 'default.log';\n\nconsole.log({ logfile, color });\n```\n\nExample usage showing negated options, and when an option is used\nmultiple ways then last one wins.\n\n```console\n$ node negate.js\n{ logfile: 'default.log', color: undefined }\n$ node negate.js --no-logfile --no-color\n{ logfile: false, color: false }\n$ node negate.js --logfile=test.log --color\n{ logfile: 'test.log', color: true }\n$ node negate.js --no-logfile --logfile=test.log --color --no-color\n{ logfile: 'test.log', color: false }\n```","summary":"Detailed parse information is available for adding custom behaviors by specifying `tokens: true` in the configuration. The returned tokens have properties describing:","examples":[{"language":"mjs","displayName":null,"code":"import { parseArgs } from 'node:util';\n\nconst options = {\n  'color': { type: 'boolean' },\n  'no-color': { type: 'boolean' },\n  'logfile': { type: 'string' },\n  'no-logfile': { type: 'boolean' },\n};\nconst { values, tokens } = parseArgs({ options, tokens: true });\n\n// Reprocess the option tokens and overwrite the returned values.\ntokens\n  .filter((token) => token.kind === 'option')\n  .forEach((token) => {\n    if (token.name.startsWith('no-')) {\n      // Store foo:false for --no-foo\n      const positiveName = token.name.slice(3);\n      values[positiveName] = false;\n      delete values[token.name];\n    } else {\n      // Resave value so last one wins if both --foo and --no-foo.\n      values[token.name] = token.value ?? true;\n    }\n  });\n\nconst color = values.color;\nconst logfile = values.logfile ?? 'default.log';\n\nconsole.log({ logfile, color });"},{"language":"cjs","displayName":null,"code":"const { parseArgs } = require('node:util');\n\nconst options = {\n  'color': { type: 'boolean' },\n  'no-color': { type: 'boolean' },\n  'logfile': { type: 'string' },\n  'no-logfile': { type: 'boolean' },\n};\nconst { values, tokens } = parseArgs({ options, tokens: true });\n\n// Reprocess the option tokens and overwrite the returned values.\ntokens\n  .filter((token) => token.kind === 'option')\n  .forEach((token) => {\n    if (token.name.startsWith('no-')) {\n      // Store foo:false for --no-foo\n      const positiveName = token.name.slice(3);\n      values[positiveName] = false;\n      delete values[token.name];\n    } else {\n      // Resave value so last one wins if both --foo and --no-foo.\n      values[token.name] = token.value ?? true;\n    }\n  });\n\nconst color = values.color;\nconst logfile = values.logfile ?? 'default.log';\n\nconsole.log({ logfile, color });"},{"language":"console","displayName":null,"code":"$ node negate.js\n{ logfile: 'default.log', color: undefined }\n$ node negate.js --no-logfile --no-color\n{ logfile: false, color: false }\n$ node negate.js --logfile=test.log --color\n{ logfile: 'test.log', color: true }\n$ node negate.js --no-logfile --logfile=test.log --color --no-color\n{ logfile: 'test.log', color: false }"}],"children":[]}]},{"kind":"method","id":"utilparseenvcontent","name":"parseEnv","title":"`util.parseEnv(content)`","scope":"module","overloadOf":null,"stability":null,"added":["v21.7.0","v20.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v24.10.0","v22.21.0"],"prUrl":"https://github.com/nodejs/node/pull/59925","commit":null,"description":"This API is no longer experimental."}],"signature":{"parameters":[{"name":"content","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The raw contents of a `.env` file.\n\n* Returns: {Object}\n\nGiven an example `.env` file:\n\n```cjs\nconst { parseEnv } = require('node:util');\n\nparseEnv('HELLO=world\\nHELLO=oh my\\n');\n// Returns: { HELLO: 'oh my' }\n```\n\n```mjs\nimport { parseEnv } from 'node:util';\n\nparseEnv('HELLO=world\\nHELLO=oh my\\n');\n// Returns: { HELLO: 'oh my' }\n```","summary":"The raw contents of a `.env` file.","examples":[{"language":"cjs","displayName":null,"code":"const { parseEnv } = require('node:util');\n\nparseEnv('HELLO=world\\nHELLO=oh my\\n');\n// Returns: { HELLO: 'oh my' }"},{"language":"mjs","displayName":null,"code":"import { parseEnv } from 'node:util';\n\nparseEnv('HELLO=world\\nHELLO=oh my\\n');\n// Returns: { HELLO: 'oh my' }"}],"children":[]},{"kind":"method","id":"utilpromisifyoriginal","name":"promisify","title":"`util.promisify(original)`","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v20.8.0"],"prUrl":"https://github.com/nodejs/node/pull/49647","commit":null,"description":"Calling `promisify` on a function that returns a `Promise` is deprecated."}],"signature":{"parameters":[{"name":"original","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":""}},"description":"Takes a function following the common error-first callback style, i.e. taking\nan `(err, value) => ...` callback as the last argument, and returns a version\nthat returns promises.\n\n```mjs\nimport { promisify } from 'node:util';\nimport { stat } from 'node:fs';\n\nconst promisifiedStat = promisify(stat);\npromisifiedStat('.').then((stats) => {\n  // Do something with `stats`\n}).catch((error) => {\n  // Handle the error.\n});\n```\n\n```cjs\nconst { promisify } = require('node:util');\nconst { stat } = require('node:fs');\n\nconst promisifiedStat = promisify(stat);\npromisifiedStat('.').then((stats) => {\n  // Do something with `stats`\n}).catch((error) => {\n  // Handle the error.\n});\n```\n\nOr, equivalently using `async function`s:\n\n```mjs\nimport { promisify } from 'node:util';\nimport { stat } from 'node:fs';\n\nconst promisifiedStat = promisify(stat);\n\nasync function callStat() {\n  const stats = await promisifiedStat('.');\n  console.log(`This directory is owned by ${stats.uid}`);\n}\n\ncallStat();\n```\n\n```cjs\nconst { promisify } = require('node:util');\nconst { stat } = require('node:fs');\n\nconst promisifiedStat = promisify(stat);\n\nasync function callStat() {\n  const stats = await promisifiedStat('.');\n  console.log(`This directory is owned by ${stats.uid}`);\n}\n\ncallStat();\n```\n\nIf there is an `original[util.promisify.custom]` property present, `promisify`\nwill return its value, see [Custom promisified functions](#custom-promisified-functions).\n\n`promisify()` assumes that `original` is a function taking a callback as its\nfinal argument in all cases. If `original` is not a function, `promisify()`\nwill throw an error. If `original` is a function but its last argument is not\nan error-first callback, it will still be passed an error-first\ncallback as its last argument.\n\nUsing `promisify()` on class methods or other methods that use `this` may not\nwork as expected unless handled specially:\n\n```mjs\nimport { promisify } from 'node:util';\n\nclass Foo {\n  constructor() {\n    this.a = 42;\n  }\n\n  bar(callback) {\n    callback(null, this.a);\n  }\n}\n\nconst foo = new Foo();\n\nconst naiveBar = promisify(foo.bar);\n// TypeError: Cannot read properties of undefined (reading 'a')\n// naiveBar().then(a => console.log(a));\n\nnaiveBar.call(foo).then((a) => console.log(a)); // '42'\n\nconst bindBar = naiveBar.bind(foo);\nbindBar().then((a) => console.log(a)); // '42'\n```\n\n```cjs\nconst { promisify } = require('node:util');\n\nclass Foo {\n  constructor() {\n    this.a = 42;\n  }\n\n  bar(callback) {\n    callback(null, this.a);\n  }\n}\n\nconst foo = new Foo();\n\nconst naiveBar = promisify(foo.bar);\n// TypeError: Cannot read properties of undefined (reading 'a')\n// naiveBar().then(a => console.log(a));\n\nnaiveBar.call(foo).then((a) => console.log(a)); // '42'\n\nconst bindBar = naiveBar.bind(foo);\nbindBar().then((a) => console.log(a)); // '42'\n```","summary":"Takes a function following the common error-first callback style, i.e. taking an `(err, value) => ...` callback as the last argument, and returns a version that returns promises.","examples":[{"language":"mjs","displayName":null,"code":"import { promisify } from 'node:util';\nimport { stat } from 'node:fs';\n\nconst promisifiedStat = promisify(stat);\npromisifiedStat('.').then((stats) => {\n  // Do something with `stats`\n}).catch((error) => {\n  // Handle the error.\n});"},{"language":"cjs","displayName":null,"code":"const { promisify } = require('node:util');\nconst { stat } = require('node:fs');\n\nconst promisifiedStat = promisify(stat);\npromisifiedStat('.').then((stats) => {\n  // Do something with `stats`\n}).catch((error) => {\n  // Handle the error.\n});"},{"language":"mjs","displayName":null,"code":"import { promisify } from 'node:util';\nimport { stat } from 'node:fs';\n\nconst promisifiedStat = promisify(stat);\n\nasync function callStat() {\n  const stats = await promisifiedStat('.');\n  console.log(`This directory is owned by ${stats.uid}`);\n}\n\ncallStat();"},{"language":"cjs","displayName":null,"code":"const { promisify } = require('node:util');\nconst { stat } = require('node:fs');\n\nconst promisifiedStat = promisify(stat);\n\nasync function callStat() {\n  const stats = await promisifiedStat('.');\n  console.log(`This directory is owned by ${stats.uid}`);\n}\n\ncallStat();"},{"language":"mjs","displayName":null,"code":"import { promisify } from 'node:util';\n\nclass Foo {\n  constructor() {\n    this.a = 42;\n  }\n\n  bar(callback) {\n    callback(null, this.a);\n  }\n}\n\nconst foo = new Foo();\n\nconst naiveBar = promisify(foo.bar);\n// TypeError: Cannot read properties of undefined (reading 'a')\n// naiveBar().then(a => console.log(a));\n\nnaiveBar.call(foo).then((a) => console.log(a)); // '42'\n\nconst bindBar = naiveBar.bind(foo);\nbindBar().then((a) => console.log(a)); // '42'"},{"language":"cjs","displayName":null,"code":"const { promisify } = require('node:util');\n\nclass Foo {\n  constructor() {\n    this.a = 42;\n  }\n\n  bar(callback) {\n    callback(null, this.a);\n  }\n}\n\nconst foo = new Foo();\n\nconst naiveBar = promisify(foo.bar);\n// TypeError: Cannot read properties of undefined (reading 'a')\n// naiveBar().then(a => console.log(a));\n\nnaiveBar.call(foo).then((a) => console.log(a)); // '42'\n\nconst bindBar = naiveBar.bind(foo);\nbindBar().then((a) => console.log(a)); // '42'"}],"children":[{"kind":"section","id":"custom-promisified-functions","name":"Custom promisified functions","title":"Custom promisified functions","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Using the `util.promisify.custom` symbol one can override the return value of\n[`util.promisify()`](#utilpromisifyoriginal):\n\n```mjs\nimport { promisify } from 'node:util';\n\nfunction doSomething(foo, callback) {\n  // ...\n}\n\ndoSomething[promisify.custom] = (foo) => {\n  return getPromiseSomehow();\n};\n\nconst promisified = promisify(doSomething);\nconsole.log(promisified === doSomething[promisify.custom]);\n// prints 'true'\n```\n\n```cjs\nconst { promisify } = require('node:util');\n\nfunction doSomething(foo, callback) {\n  // ...\n}\n\ndoSomething[promisify.custom] = (foo) => {\n  return getPromiseSomehow();\n};\n\nconst promisified = promisify(doSomething);\nconsole.log(promisified === doSomething[promisify.custom]);\n// prints 'true'\n```\n\nThis can be useful for cases where the original function does not follow the\nstandard format of taking an error-first callback as the last argument.\n\nFor example, with a function that takes in\n`(foo, onSuccessCallback, onErrorCallback)`:\n\n```js\ndoSomething[util.promisify.custom] = (foo) => {\n  return new Promise((resolve, reject) => {\n    doSomething(foo, resolve, reject);\n  });\n};\n```\n\nIf `promisify.custom` is defined but is not a function, `promisify()` will\nthrow an error.","summary":"Using the `util.promisify.custom` symbol one can override the return value of `util.promisify()`:","examples":[{"language":"mjs","displayName":null,"code":"import { promisify } from 'node:util';\n\nfunction doSomething(foo, callback) {\n  // ...\n}\n\ndoSomething[promisify.custom] = (foo) => {\n  return getPromiseSomehow();\n};\n\nconst promisified = promisify(doSomething);\nconsole.log(promisified === doSomething[promisify.custom]);\n// prints 'true'"},{"language":"cjs","displayName":null,"code":"const { promisify } = require('node:util');\n\nfunction doSomething(foo, callback) {\n  // ...\n}\n\ndoSomething[promisify.custom] = (foo) => {\n  return getPromiseSomehow();\n};\n\nconst promisified = promisify(doSomething);\nconsole.log(promisified === doSomething[promisify.custom]);\n// prints 'true'"},{"language":"js","displayName":null,"code":"doSomething[util.promisify.custom] = (foo) => {\n  return new Promise((resolve, reject) => {\n    doSomething(foo, resolve, reject);\n  });\n};"}],"children":[]},{"kind":"property","id":"utilpromisifycustom","name":"custom","title":"`util.promisify.custom`","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v13.12.0","v12.16.2"],"prUrl":"https://github.com/nodejs/node/pull/31672","commit":null,"description":"This is now defined as a shared symbol."}],"type":{"text":"symbol","links":[{"name":"symbol","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type","start":0,"end":6}]},"default":null,"description":"that can be used to declare custom promisified variants of functions,\nsee [Custom promisified functions](#custom-promisified-functions).\n\nIn addition to being accessible through `util.promisify.custom`, this\nsymbol is [registered globally](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/for) and can be\naccessed in any environment as `Symbol.for('nodejs.util.promisify.custom')`.\n\nFor example, with a function that takes in\n`(foo, onSuccessCallback, onErrorCallback)`:\n\n```js\nconst kCustomPromisifiedSymbol = Symbol.for('nodejs.util.promisify.custom');\n\ndoSomething[kCustomPromisifiedSymbol] = (foo) => {\n  return new Promise((resolve, reject) => {\n    doSomething(foo, resolve, reject);\n  });\n};\n```","summary":"In addition to being accessible through `util.promisify.custom`, this symbol is registered globally and can be accessed in any environment as `Symbol.for('nodejs.util.promisify.custom')`.","examples":[{"language":"js","displayName":null,"code":"const kCustomPromisifiedSymbol = Symbol.for('nodejs.util.promisify.custom');\n\ndoSomething[kCustomPromisifiedSymbol] = (foo) => {\n  return new Promise((resolve, reject) => {\n    doSomething(foo, resolve, reject);\n  });\n};"}],"children":[]}]},{"kind":"method","id":"utilstripvtcontrolcharactersstr","name":"stripVTControlCharacters","title":"`util.stripVTControlCharacters(str)`","scope":"module","overloadOf":null,"stability":null,"added":["v16.11.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"str","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":""}},"description":"Returns `str` with any ANSI escape codes removed.\n\n```js\nconsole.log(util.stripVTControlCharacters('\\u001B[4mvalue\\u001B[0m'));\n// Prints \"value\"\n```","summary":"Returns `str` with any ANSI escape codes removed.","examples":[{"language":"js","displayName":null,"code":"console.log(util.stripVTControlCharacters('\\u001B[4mvalue\\u001B[0m'));\n// Prints \"value\""}],"children":[]},{"kind":"method","id":"utilstyletextformat-text-options","name":"styleText","title":"`util.styleText(format, text[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v21.7.0","v20.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.1.0"],"prUrl":"https://github.com/nodejs/node/pull/61556","commit":null,"description":"Add support for hexadecimal colors."},{"versions":["v24.2.0","v22.17.0"],"prUrl":"https://github.com/nodejs/node/pull/58437","commit":null,"description":"Added the `'none'` format as a non-op format."},{"versions":["v23.5.0","v22.13.0"],"prUrl":"https://github.com/nodejs/node/pull/56265","commit":null,"description":"styleText is now stable."},{"versions":["v22.8.0","v20.18.0"],"prUrl":"https://github.com/nodejs/node/pull/54389","commit":null,"description":"Respect isTTY and environment variables such as NO_COLOR, NODE_DISABLE_COLORS, and FORCE_COLOR."}],"signature":{"parameters":[{"name":"format","type":{"text":"string | Array","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array","start":9,"end":14}]},"description":"A text format or an Array\nof text formats defined in `util.inspect.colors`, or a hex color in `#RGB`\nor `#RRGGBB` form.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"text","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The text to be formatted.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"validateStream","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"When true, `stream` is checked to see if it can handle colors.","default":"true","optional":true,"rest":false,"properties":[]},{"name":"stream","type":{"text":"Stream","links":[{"name":"Stream","href":"stream.html#stream","start":0,"end":6}]},"description":"A stream that will be validated if it can be colored.","default":"process.stdout","optional":true,"rest":false,"properties":[]}]}],"returns":null},"description":"This function returns a formatted text considering the `format` passed\nfor printing in a terminal. It is aware of the terminal's capabilities\nand acts according to the configuration set via `NO_COLOR`,\n`NODE_DISABLE_COLORS` and `FORCE_COLOR` environment variables.\n\n```mjs\nimport { styleText } from 'node:util';\nimport { stderr } from 'node:process';\n\nconst successMessage = styleText('green', 'Success!');\nconsole.log(successMessage);\n\nconst errorMessage = styleText(\n  'red',\n  'Error! Error!',\n  // Validate if process.stderr has TTY\n  { stream: stderr },\n);\nconsole.error(errorMessage);\n```\n\n```cjs\nconst { styleText } = require('node:util');\nconst { stderr } = require('node:process');\n\nconst successMessage = styleText('green', 'Success!');\nconsole.log(successMessage);\n\nconst errorMessage = styleText(\n  'red',\n  'Error! Error!',\n  // Validate if process.stderr has TTY\n  { stream: stderr },\n);\nconsole.error(errorMessage);\n```\n\n`util.inspect.colors` also provides text formats such as `italic`, and\n`underline` and you can combine both:\n\n```cjs\nconsole.log(\n  util.styleText(['underline', 'italic'], 'My italic underlined message'),\n);\n```\n\nWhen passing an array of formats, the order of the format applied\nis left to right so the following style might overwrite the previous one.\n\n```cjs\nconsole.log(\n  util.styleText(['red', 'green'], 'text'), // green\n);\n```\n\nThe special format value `none` applies no additional styling to the text.\n\nIn addition to predefined color names, `util.styleText()` supports hex color\nstrings using ANSI TrueColor (24-bit) escape sequences. Hex colors can be\nspecified in either 3-digit (`#RGB`) or 6-digit (`#RRGGBB`) format:\n\n```mjs\nimport { styleText } from 'node:util';\n\n// 6-digit hex color\nconsole.log(styleText('#ff5733', 'Orange text'));\n\n// 3-digit hex color (shorthand)\nconsole.log(styleText('#f00', 'Red text'));\n```\n\n```cjs\nconst { styleText } = require('node:util');\n\n// 6-digit hex color\nconsole.log(styleText('#ff5733', 'Orange text'));\n\n// 3-digit hex color (shorthand)\nconsole.log(styleText('#f00', 'Red text'));\n```\n\nThe full list of formats can be found in [modifiers](#modifiers).","summary":"This function returns a formatted text considering the `format` passed for printing in a terminal. It is aware of the terminal's capabilities and acts according to the configuration set via `NO_COLOR`, `NODE_DISABLE_COLORS` and `FORCE_COLOR` environment variables.","examples":[{"language":"mjs","displayName":null,"code":"import { styleText } from 'node:util';\nimport { stderr } from 'node:process';\n\nconst successMessage = styleText('green', 'Success!');\nconsole.log(successMessage);\n\nconst errorMessage = styleText(\n  'red',\n  'Error! Error!',\n  // Validate if process.stderr has TTY\n  { stream: stderr },\n);\nconsole.error(errorMessage);"},{"language":"cjs","displayName":null,"code":"const { styleText } = require('node:util');\nconst { stderr } = require('node:process');\n\nconst successMessage = styleText('green', 'Success!');\nconsole.log(successMessage);\n\nconst errorMessage = styleText(\n  'red',\n  'Error! Error!',\n  // Validate if process.stderr has TTY\n  { stream: stderr },\n);\nconsole.error(errorMessage);"},{"language":"cjs","displayName":null,"code":"console.log(\n  util.styleText(['underline', 'italic'], 'My italic underlined message'),\n);"},{"language":"cjs","displayName":null,"code":"console.log(\n  util.styleText(['red', 'green'], 'text'), // green\n);"},{"language":"mjs","displayName":null,"code":"import { styleText } from 'node:util';\n\n// 6-digit hex color\nconsole.log(styleText('#ff5733', 'Orange text'));\n\n// 3-digit hex color (shorthand)\nconsole.log(styleText('#f00', 'Red text'));"},{"language":"cjs","displayName":null,"code":"const { styleText } = require('node:util');\n\n// 6-digit hex color\nconsole.log(styleText('#ff5733', 'Orange text'));\n\n// 3-digit hex color (shorthand)\nconsole.log(styleText('#f00', 'Red text'));"}],"children":[]},{"kind":"class","id":"class-utiltextdecoder","name":"TextDecoder","title":"Class: `util.TextDecoder`","scope":"module","overloadOf":null,"stability":null,"added":["v8.3.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v11.0.0"],"prUrl":"https://github.com/nodejs/node/pull/22281","commit":null,"description":"The class is now available on the global object."}],"extends":null,"description":"An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.\n\n```js\nconst decoder = new TextDecoder();\nconst u8arr = new Uint8Array([72, 101, 108, 108, 111]);\nconsole.log(decoder.decode(u8arr)); // Hello\n```","summary":"An implementation of the WHATWG Encoding Standard `TextDecoder` API.","examples":[{"language":"js","displayName":null,"code":"const decoder = new TextDecoder();\nconst u8arr = new Uint8Array([72, 101, 108, 108, 111]);\nconsole.log(decoder.decode(u8arr)); // Hello"}],"children":[{"kind":"section","id":"whatwg-supported-encodings","name":"WHATWG supported encodings","title":"WHATWG supported encodings","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Per the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/), the encodings supported by the\n`TextDecoder` API are outlined in the tables below. For each encoding,\none or more aliases may be used.\n\nDifferent Node.js build configurations support different sets of encodings.\n(see [Internationalization](intl.html))","summary":"Per the WHATWG Encoding Standard, the encodings supported by the `TextDecoder` API are outlined in the tables below. For each encoding, one or more aliases may be used.","examples":[],"children":[{"kind":"section","id":"encodings-supported-by-default-with-full-icu-data","name":"Encodings supported by default (with full ICU data)","title":"Encodings supported by default (with full ICU data)","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"| Encoding           | Aliases                                                                                                                                                                                                                             |\n| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `'ibm866'`         | `'866'`, `'cp866'`, `'csibm866'`                                                                                                                                                                                                    |\n| `'iso-8859-2'`     | `'csisolatin2'`, `'iso-ir-101'`, `'iso8859-2'`, `'iso88592'`, `'iso_8859-2'`, `'iso_8859-2:1987'`, `'l2'`, `'latin2'`                                                                                                               |\n| `'iso-8859-3'`     | `'csisolatin3'`, `'iso-ir-109'`, `'iso8859-3'`, `'iso88593'`, `'iso_8859-3'`, `'iso_8859-3:1988'`, `'l3'`, `'latin3'`                                                                                                               |\n| `'iso-8859-4'`     | `'csisolatin4'`, `'iso-ir-110'`, `'iso8859-4'`, `'iso88594'`, `'iso_8859-4'`, `'iso_8859-4:1988'`, `'l4'`, `'latin4'`                                                                                                               |\n| `'iso-8859-5'`     | `'csisolatincyrillic'`, `'cyrillic'`, `'iso-ir-144'`, `'iso8859-5'`, `'iso88595'`, `'iso_8859-5'`, `'iso_8859-5:1988'`                                                                                                              |\n| `'iso-8859-6'`     | `'arabic'`, `'asmo-708'`, `'csiso88596e'`, `'csiso88596i'`, `'csisolatinarabic'`, `'ecma-114'`, `'iso-8859-6-e'`, `'iso-8859-6-i'`, `'iso-ir-127'`, `'iso8859-6'`, `'iso88596'`, `'iso_8859-6'`, `'iso_8859-6:1987'`                |\n| `'iso-8859-7'`     | `'csisolatingreek'`, `'ecma-118'`, `'elot_928'`, `'greek'`, `'greek8'`, `'iso-ir-126'`, `'iso8859-7'`, `'iso88597'`, `'iso_8859-7'`, `'iso_8859-7:1987'`, `'sun_eu_greek'`                                                          |\n| `'iso-8859-8'`     | `'csiso88598e'`, `'csisolatinhebrew'`, `'hebrew'`, `'iso-8859-8-e'`, `'iso-ir-138'`, `'iso8859-8'`, `'iso88598'`, `'iso_8859-8'`, `'iso_8859-8:1988'`, `'visual'`                                                                   |\n| `'iso-8859-8-i'`   | `'csiso88598i'`, `'logical'`                                                                                                                                                                                                        |\n| `'iso-8859-10'`    | `'csisolatin6'`, `'iso-ir-157'`, `'iso8859-10'`, `'iso885910'`, `'l6'`, `'latin6'`                                                                                                                                                  |\n| `'iso-8859-13'`    | `'iso8859-13'`, `'iso885913'`                                                                                                                                                                                                       |\n| `'iso-8859-14'`    | `'iso8859-14'`, `'iso885914'`                                                                                                                                                                                                       |\n| `'iso-8859-15'`    | `'csisolatin9'`, `'iso8859-15'`, `'iso885915'`, `'iso_8859-15'`, `'l9'`                                                                                                                                                             |\n| `'koi8-r'`         | `'cskoi8r'`, `'koi'`, `'koi8'`, `'koi8_r'`                                                                                                                                                                                          |\n| `'koi8-u'`         | `'koi8-ru'`                                                                                                                                                                                                                         |\n| `'macintosh'`      | `'csmacintosh'`, `'mac'`, `'x-mac-roman'`                                                                                                                                                                                           |\n| `'windows-874'`    | `'dos-874'`, `'iso-8859-11'`, `'iso8859-11'`, `'iso885911'`, `'tis-620'`                                                                                                                                                            |\n| `'windows-1250'`   | `'cp1250'`, `'x-cp1250'`                                                                                                                                                                                                            |\n| `'windows-1251'`   | `'cp1251'`, `'x-cp1251'`                                                                                                                                                                                                            |\n| `'windows-1252'`   | `'ansi_x3.4-1968'`, `'ascii'`, `'cp1252'`, `'cp819'`, `'csisolatin1'`, `'ibm819'`, `'iso-8859-1'`, `'iso-ir-100'`, `'iso8859-1'`, `'iso88591'`, `'iso_8859-1'`, `'iso_8859-1:1987'`, `'l1'`, `'latin1'`, `'us-ascii'`, `'x-cp1252'` |\n| `'windows-1253'`   | `'cp1253'`, `'x-cp1253'`                                                                                                                                                                                                            |\n| `'windows-1254'`   | `'cp1254'`, `'csisolatin5'`, `'iso-8859-9'`, `'iso-ir-148'`, `'iso8859-9'`, `'iso88599'`, `'iso_8859-9'`, `'iso_8859-9:1989'`, `'l5'`, `'latin5'`, `'x-cp1254'`                                                                     |\n| `'windows-1255'`   | `'cp1255'`, `'x-cp1255'`                                                                                                                                                                                                            |\n| `'windows-1256'`   | `'cp1256'`, `'x-cp1256'`                                                                                                                                                                                                            |\n| `'windows-1257'`   | `'cp1257'`, `'x-cp1257'`                                                                                                                                                                                                            |\n| `'windows-1258'`   | `'cp1258'`, `'x-cp1258'`                                                                                                                                                                                                            |\n| `'x-mac-cyrillic'` | `'x-mac-ukrainian'`                                                                                                                                                                                                                 |\n| `'gbk'`            | `'chinese'`, `'csgb2312'`, `'csiso58gb231280'`, `'gb2312'`, `'gb_2312'`, `'gb_2312-80'`, `'iso-ir-58'`, `'x-gbk'`                                                                                                                   |\n| `'gb18030'`        |                                                                                                                                                                                                                                     |\n| `'big5'`           | `'big5-hkscs'`, `'cn-big5'`, `'csbig5'`, `'x-x-big5'`                                                                                                                                                                               |\n| `'euc-jp'`         | `'cseucpkdfmtjapanese'`, `'x-euc-jp'`                                                                                                                                                                                               |\n| `'iso-2022-jp'`    | `'csiso2022jp'`                                                                                                                                                                                                                     |\n| `'shift_jis'`      | `'csshiftjis'`, `'ms932'`, `'ms_kanji'`, `'shift-jis'`, `'sjis'`, `'windows-31j'`, `'x-sjis'`                                                                                                                                       |\n| `'euc-kr'`         | `'cseuckr'`, `'csksc56011987'`, `'iso-ir-149'`, `'korean'`, `'ks_c_5601-1987'`, `'ks_c_5601-1989'`, `'ksc5601'`, `'ksc_5601'`, `'windows-949'`                                                                                      |","summary":"","examples":[],"children":[]},{"kind":"section","id":"encodings-supported-when-nodejs-is-built-with-the-small-icu-option","name":"Encodings supported when Node.js is built with the small-icu option","title":"Encodings supported when Node.js is built with the `small-icu` option","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"| Encoding     | Aliases                         |\n| ------------ | ------------------------------- |\n| `'utf-8'`    | `'unicode-1-1-utf-8'`, `'utf8'` |\n| `'utf-16le'` | `'utf-16'`                      |\n| `'utf-16be'` |                                 |","summary":"","examples":[],"children":[]},{"kind":"section","id":"encodings-supported-when-icu-is-disabled","name":"Encodings supported when ICU is disabled","title":"Encodings supported when ICU is disabled","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"| Encoding     | Aliases                         |\n| ------------ | ------------------------------- |\n| `'utf-8'`    | `'unicode-1-1-utf-8'`, `'utf8'` |\n| `'utf-16le'` | `'utf-16'`                      |\n\nThe `'iso-8859-16'` encoding listed in the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/)\nis not supported.","summary":"The `'iso-8859-16'` encoding listed in the WHATWG Encoding Standard is not supported.","examples":[],"children":[]}]},{"kind":"constructor","id":"new-textdecoderencoding-options","name":"TextDecoder","title":"`new TextDecoder([encoding[, options]])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"encoding","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Identifies the `encoding` that this `TextDecoder` instance\nsupports.","default":"'utf-8'","optional":true,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"fatal","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"`true` if decoding failures are fatal.\nThis option is not supported when ICU is disabled\n(see [Internationalization](intl.html)).","default":"false","optional":true,"rest":false,"properties":[]},{"name":"ignoreBOM","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"When `true`, the `TextDecoder` will include the byte\norder mark in the decoded result. When `false`, the byte order mark will\nbe removed from the output. This option is only used when `encoding` is\n`'utf-8'`, `'utf-16be'`, or `'utf-16le'`.","default":"false","optional":true,"rest":false,"properties":[]}]}],"returns":null},"description":"Creates a new `TextDecoder` instance. The `encoding` may specify one of the\nsupported encodings or an alias.\n\nThe `TextDecoder` class is also available on the global object.","summary":"Creates a new `TextDecoder` instance. The `encoding` may specify one of the supported encodings or an alias.","examples":[],"children":[]},{"kind":"method","id":"textdecoderdecodeinput-options","name":"decode","title":"`textDecoder.decode([input[, options]])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"input","type":{"text":"ArrayBuffer | DataView | TypedArray","links":[{"name":"ArrayBuffer","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer","start":0,"end":11},{"name":"DataView","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/DataView","start":14,"end":22},{"name":"TypedArray","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray","start":25,"end":35}]},"description":"An `ArrayBuffer`, `DataView`, or\n`TypedArray` instance containing the encoded data.","default":null,"optional":true,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"stream","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"`true` if additional chunks of data are expected.","default":"false","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":""}},"description":"Decodes the `input` and returns a string. If `options.stream` is `true`, any\nincomplete byte sequences occurring at the end of the `input` are buffered\ninternally and emitted after the next call to `textDecoder.decode()`.\n\nIf `textDecoder.fatal` is `true`, decoding errors that occur will result in a\n`TypeError` being thrown.","summary":"Decodes the `input` and returns a string. If `options.stream` is `true`, any incomplete byte sequences occurring at the end of the `input` are buffered internally and emitted after the next call to `textDecoder.decode()`.","examples":[],"children":[]},{"kind":"property","id":"textdecoderencoding","name":"encoding","title":"`textDecoder.encoding`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The encoding supported by the `TextDecoder` instance.","summary":"The encoding supported by the `TextDecoder` instance.","examples":[],"children":[]},{"kind":"property","id":"textdecoderfatal","name":"fatal","title":"`textDecoder.fatal`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"The value will be `true` if decoding errors result in a `TypeError` being\nthrown.","summary":"The value will be `true` if decoding errors result in a `TypeError` being thrown.","examples":[],"children":[]},{"kind":"property","id":"textdecoderignorebom","name":"ignoreBOM","title":"`textDecoder.ignoreBOM`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"The value will be `true` if the decoding result will include the byte order\nmark.","summary":"The value will be `true` if the decoding result will include the byte order mark.","examples":[],"children":[]}]},{"kind":"class","id":"class-utiltextencoder","name":"TextEncoder","title":"Class: `util.TextEncoder`","scope":"module","overloadOf":null,"stability":null,"added":["v8.3.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v11.0.0"],"prUrl":"https://github.com/nodejs/node/pull/22281","commit":null,"description":"The class is now available on the global object."}],"extends":null,"description":"An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All\ninstances of `TextEncoder` only support UTF-8 encoding.\n\n```js\nconst encoder = new TextEncoder();\nconst uint8array = encoder.encode('this is some data');\n```\n\nThe `TextEncoder` class is also available on the global object.","summary":"An implementation of the WHATWG Encoding Standard `TextEncoder` API. All instances of `TextEncoder` only support UTF-8 encoding.","examples":[{"language":"js","displayName":null,"code":"const encoder = new TextEncoder();\nconst uint8array = encoder.encode('this is some data');"}],"children":[{"kind":"method","id":"textencoderencodeinput","name":"encode","title":"`textEncoder.encode([input])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"input","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The text to encode.","default":"an empty string","optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Uint8Array","links":[{"name":"Uint8Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array","start":0,"end":10}]},"description":""}},"description":"UTF-8 encodes the `input` string and returns a `Uint8Array` containing the\nencoded bytes.","summary":"UTF-8 encodes the `input` string and returns a `Uint8Array` containing the encoded bytes.","examples":[],"children":[]},{"kind":"method","id":"textencoderencodeintosrc-dest","name":"encodeInto","title":"`textEncoder.encodeInto(src, dest)`","scope":"module","overloadOf":null,"stability":null,"added":["v12.11.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"src","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The text to encode.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"dest","type":{"text":"Uint8Array","links":[{"name":"Uint8Array","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array","start":0,"end":10}]},"description":"The array to hold the encode result.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object\ncontaining the read Unicode code units and written UTF-8 bytes.\n\n```js\nconst encoder = new TextEncoder();\nconst src = 'this is some data';\nconst dest = new Uint8Array(10);\nconst { read, written } = encoder.encodeInto(src, dest);\n```","summary":"UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object containing the read Unicode code units and written UTF-8 bytes.","examples":[{"language":"js","displayName":null,"code":"const encoder = new TextEncoder();\nconst src = 'this is some data';\nconst dest = new Uint8Array(10);\nconst { read, written } = encoder.encodeInto(src, dest);"}],"children":[]},{"kind":"property","id":"textencoderencoding","name":"encoding","title":"`textEncoder.encoding`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`.","summary":"The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`.","examples":[],"children":[]}]},{"kind":"method","id":"utiltousvstringstring","name":"toUSVString","title":"`util.toUSVString(string)`","scope":"module","overloadOf":null,"stability":null,"added":["v16.8.0","v14.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"string","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Returns the `string` after replacing any surrogate code points\n(or equivalently, any unpaired surrogate code units) with the\nUnicode \"replacement character\" U+FFFD.","summary":"Returns the `string` after replacing any surrogate code points (or equivalently, any unpaired surrogate code units) with the Unicode \"replacement character\" U+FFFD.","examples":[],"children":[]},{"kind":"method","id":"utiltransferableabortcontroller","name":"transferableAbortController","title":"`util.transferableAbortController()`","scope":"module","overloadOf":null,"stability":null,"added":["v18.11.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v23.11.0","v22.15.0"],"prUrl":"https://github.com/nodejs/node/pull/57510","commit":null,"description":"Marking the API stable."}],"signature":{"parameters":[],"returns":null},"description":"Creates and returns an {AbortController} instance whose {AbortSignal} is marked\nas transferable and can be used with `structuredClone()` or `postMessage()`.","summary":"Creates and returns an {AbortController} instance whose {AbortSignal} is marked as transferable and can be used with `structuredClone()` or `postMessage()`.","examples":[],"children":[]},{"kind":"method","id":"utiltransferableabortsignalsignal","name":"transferableAbortSignal","title":"`util.transferableAbortSignal(signal)`","scope":"module","overloadOf":null,"stability":null,"added":["v18.11.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v23.11.0","v22.15.0"],"prUrl":"https://github.com/nodejs/node/pull/57510","commit":null,"description":"Marking the API stable."}],"signature":{"parameters":[{"name":"signal","type":{"text":"AbortSignal","links":[{"name":"AbortSignal","href":"globals.html#class-abortsignal","start":0,"end":11}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"AbortSignal","links":[{"name":"AbortSignal","href":"globals.html#class-abortsignal","start":0,"end":11}]},"description":""}},"description":"Marks the given {AbortSignal} as transferable so that it can be used with\n`structuredClone()` and `postMessage()`.\n\n```js\nconst signal = transferableAbortSignal(AbortSignal.timeout(100));\nconst channel = new MessageChannel();\nchannel.port2.postMessage(signal, [signal]);\n```","summary":"Marks the given {AbortSignal} as transferable so that it can be used with `structuredClone()` and `postMessage()`.","examples":[{"language":"js","displayName":null,"code":"const signal = transferableAbortSignal(AbortSignal.timeout(100));\nconst channel = new MessageChannel();\nchannel.port2.postMessage(signal, [signal]);"}],"children":[]},{"kind":"method","id":"utilabortedsignal-resource","name":"aborted","title":"`util.aborted(signal, resource)`","scope":"module","overloadOf":null,"stability":null,"added":["v19.7.0","v18.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v24.0.0","v22.16.0"],"prUrl":"https://github.com/nodejs/node/pull/57765","commit":null,"description":"Change stability index for this feature from Experimental to Stable."}],"signature":{"parameters":[{"name":"signal","type":{"text":"AbortSignal","links":[{"name":"AbortSignal","href":"globals.html#class-abortsignal","start":0,"end":11}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"resource","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"Any non-null object tied to the abortable operation and held weakly.\nIf `resource` is garbage collected before the `signal` aborts, the promise remains pending,\nallowing Node.js to stop tracking it.\nThis helps prevent memory leaks in long-running or non-cancelable operations.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":""}},"description":"Listens to abort event on the provided `signal` and returns a promise that resolves when the `signal` is aborted.\nIf `resource` is provided, it weakly references the operation's associated object,\nso if `resource` is garbage collected before the `signal` aborts,\nthen returned promise shall remain pending.\nThis prevents memory leaks in long-running or non-cancelable operations.\n\n```cjs\nconst { aborted } = require('node:util');\n\n// Obtain an object with an abortable signal, like a custom resource or operation.\nconst dependent = obtainSomethingAbortable();\n\n// Pass `dependent` as the resource, indicating the promise should only resolve\n// if `dependent` is still in memory when the signal is aborted.\naborted(dependent.signal, dependent).then(() => {\n\n  // This code runs when `dependent` is aborted.\n  console.log('Dependent resource was aborted.');\n});\n\n// Simulate an event that triggers the abort.\ndependent.on('event', () => {\n  dependent.abort(); // This will cause the `aborted` promise to resolve.\n});\n```\n\n```mjs\nimport { aborted } from 'node:util';\n\n// Obtain an object with an abortable signal, like a custom resource or operation.\nconst dependent = obtainSomethingAbortable();\n\n// Pass `dependent` as the resource, indicating the promise should only resolve\n// if `dependent` is still in memory when the signal is aborted.\naborted(dependent.signal, dependent).then(() => {\n\n  // This code runs when `dependent` is aborted.\n  console.log('Dependent resource was aborted.');\n});\n\n// Simulate an event that triggers the abort.\ndependent.on('event', () => {\n  dependent.abort(); // This will cause the `aborted` promise to resolve.\n});\n```","summary":"Listens to abort event on the provided `signal` and returns a promise that resolves when the `signal` is aborted. If `resource` is provided, it weakly references the operation's associated object, so if `resource` is garbage collected before the `signal` aborts, then returned promise shall remain pending. This prevents memory leaks in long-running or non-cancelable operations.","examples":[{"language":"cjs","displayName":null,"code":"const { aborted } = require('node:util');\n\n// Obtain an object with an abortable signal, like a custom resource or operation.\nconst dependent = obtainSomethingAbortable();\n\n// Pass `dependent` as the resource, indicating the promise should only resolve\n// if `dependent` is still in memory when the signal is aborted.\naborted(dependent.signal, dependent).then(() => {\n\n  // This code runs when `dependent` is aborted.\n  console.log('Dependent resource was aborted.');\n});\n\n// Simulate an event that triggers the abort.\ndependent.on('event', () => {\n  dependent.abort(); // This will cause the `aborted` promise to resolve.\n});"},{"language":"mjs","displayName":null,"code":"import { aborted } from 'node:util';\n\n// Obtain an object with an abortable signal, like a custom resource or operation.\nconst dependent = obtainSomethingAbortable();\n\n// Pass `dependent` as the resource, indicating the promise should only resolve\n// if `dependent` is still in memory when the signal is aborted.\naborted(dependent.signal, dependent).then(() => {\n\n  // This code runs when `dependent` is aborted.\n  console.log('Dependent resource was aborted.');\n});\n\n// Simulate an event that triggers the abort.\ndependent.on('event', () => {\n  dependent.abort(); // This will cause the `aborted` promise to resolve.\n});"}],"children":[]},{"kind":"property","id":"utiltypes","name":"types","title":"`util.types`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v15.3.0"],"prUrl":"https://github.com/nodejs/node/pull/34055","commit":null,"description":"Exposed as `require('util/types')`."}],"type":null,"default":null,"description":"`util.types` provides type checks for different kinds of built-in objects.\nUnlike `instanceof` or `Object.prototype.toString.call(value)`, these checks do\nnot inspect properties of the object that are accessible from JavaScript (like\ntheir prototype), and usually have the overhead of calling into C++.\n\nThe result generally does not make any guarantees about what kinds of\nproperties or behavior a value exposes in JavaScript. They are primarily\nuseful for addon developers who prefer to do type checking in JavaScript.\n\nThe API is accessible via `require('node:util').types` or `require('node:util/types')`.","summary":"`util.types` provides type checks for different kinds of built-in objects. Unlike `instanceof` or `Object.prototype.toString.call(value)`, these checks do not inspect properties of the object that are accessible from JavaScript (like their prototype), and usually have the overhead of calling into C++.","examples":[],"children":[{"kind":"method","id":"utiltypesisanyarraybuffervalue","name":"isAnyArrayBuffer","title":"`util.types.isAnyArrayBuffer(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {ArrayBuffer} or\n{SharedArrayBuffer} instance.\n\nSee also [`util.types.isArrayBuffer()`](#utiltypesisarraybuffervalue) and\n[`util.types.isSharedArrayBuffer()`](#utiltypesissharedarraybuffervalue).\n\n```js\nutil.types.isAnyArrayBuffer(new ArrayBuffer());  // Returns true\nutil.types.isAnyArrayBuffer(new SharedArrayBuffer());  // Returns true\n```","summary":"Returns `true` if the value is a built-in {ArrayBuffer} or {SharedArrayBuffer} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isAnyArrayBuffer(new ArrayBuffer());  // Returns true\nutil.types.isAnyArrayBuffer(new SharedArrayBuffer());  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisarraybufferviewvalue","name":"isArrayBufferView","title":"`util.types.isArrayBufferView(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is an instance of one of the {ArrayBuffer}\nviews, such as typed array objects or {DataView}. Equivalent to\n[`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).\n\n```js\nutil.types.isArrayBufferView(new Int8Array());  // true\nutil.types.isArrayBufferView(Buffer.from('hello world')); // true\nutil.types.isArrayBufferView(new DataView(new ArrayBuffer(16)));  // true\nutil.types.isArrayBufferView(new ArrayBuffer());  // false\n```","summary":"Returns `true` if the value is an instance of one of the {ArrayBuffer} views, such as typed array objects or {DataView}. Equivalent to `ArrayBuffer.isView()`.","examples":[{"language":"js","displayName":null,"code":"util.types.isArrayBufferView(new Int8Array());  // true\nutil.types.isArrayBufferView(Buffer.from('hello world')); // true\nutil.types.isArrayBufferView(new DataView(new ArrayBuffer(16)));  // true\nutil.types.isArrayBufferView(new ArrayBuffer());  // false"}],"children":[]},{"kind":"method","id":"utiltypesisargumentsobjectvalue","name":"isArgumentsObject","title":"`util.types.isArgumentsObject(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is an `arguments` object.\n\n```js\nfunction foo() {\n  util.types.isArgumentsObject(arguments);  // Returns true\n}\n```","summary":"Returns `true` if the value is an `arguments` object.","examples":[{"language":"js","displayName":null,"code":"function foo() {\n  util.types.isArgumentsObject(arguments);  // Returns true\n}"}],"children":[]},{"kind":"method","id":"utiltypesisarraybuffervalue","name":"isArrayBuffer","title":"`util.types.isArrayBuffer(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {ArrayBuffer} instance.\nThis does *not* include {SharedArrayBuffer} instances. Usually, it is\ndesirable to test for both; See [`util.types.isAnyArrayBuffer()`](#utiltypesisanyarraybuffervalue) for that.\n\n```js\nutil.types.isArrayBuffer(new ArrayBuffer());  // Returns true\nutil.types.isArrayBuffer(new SharedArrayBuffer());  // Returns false\n```","summary":"Returns `true` if the value is a built-in {ArrayBuffer} instance. This does _not_ include {SharedArrayBuffer} instances. Usually, it is desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.","examples":[{"language":"js","displayName":null,"code":"util.types.isArrayBuffer(new ArrayBuffer());  // Returns true\nutil.types.isArrayBuffer(new SharedArrayBuffer());  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisasyncfunctionvalue","name":"isAsyncFunction","title":"`util.types.isAsyncFunction(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).\nThis only reports back what the JavaScript engine is seeing;\nin particular, the return value may not match the original source code if\na transpilation tool was used.\n\n```js\nutil.types.isAsyncFunction(function foo() {});  // Returns false\nutil.types.isAsyncFunction(async function foo() {});  // Returns true\n```","summary":"Returns `true` if the value is an async function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used.","examples":[{"language":"js","displayName":null,"code":"util.types.isAsyncFunction(function foo() {});  // Returns false\nutil.types.isAsyncFunction(async function foo() {});  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisbigint64arrayvalue","name":"isBigInt64Array","title":"`util.types.isBigInt64Array(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a `BigInt64Array` instance.\n\n```js\nutil.types.isBigInt64Array(new BigInt64Array());   // Returns true\nutil.types.isBigInt64Array(new BigUint64Array());  // Returns false\n```","summary":"Returns `true` if the value is a `BigInt64Array` instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isBigInt64Array(new BigInt64Array());   // Returns true\nutil.types.isBigInt64Array(new BigUint64Array());  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisbigintobjectvalue","name":"isBigIntObject","title":"`util.types.isBigIntObject(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.4.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a BigInt object, e.g. created\nby `Object(BigInt(123))`.\n\n```js\nutil.types.isBigIntObject(Object(BigInt(123)));   // Returns true\nutil.types.isBigIntObject(BigInt(123));   // Returns false\nutil.types.isBigIntObject(123);  // Returns false\n```","summary":"Returns `true` if the value is a BigInt object, e.g. created by `Object(BigInt(123))`.","examples":[{"language":"js","displayName":null,"code":"util.types.isBigIntObject(Object(BigInt(123)));   // Returns true\nutil.types.isBigIntObject(BigInt(123));   // Returns false\nutil.types.isBigIntObject(123);  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisbiguint64arrayvalue","name":"isBigUint64Array","title":"`util.types.isBigUint64Array(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a `BigUint64Array` instance.\n\n```js\nutil.types.isBigUint64Array(new BigInt64Array());   // Returns false\nutil.types.isBigUint64Array(new BigUint64Array());  // Returns true\n```","summary":"Returns `true` if the value is a `BigUint64Array` instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isBigUint64Array(new BigInt64Array());   // Returns false\nutil.types.isBigUint64Array(new BigUint64Array());  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisbooleanobjectvalue","name":"isBooleanObject","title":"`util.types.isBooleanObject(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a boolean object, e.g. created\nby `new Boolean()`.\n\n```js\nutil.types.isBooleanObject(false);  // Returns false\nutil.types.isBooleanObject(true);   // Returns false\nutil.types.isBooleanObject(new Boolean(false)); // Returns true\nutil.types.isBooleanObject(new Boolean(true));  // Returns true\nutil.types.isBooleanObject(Boolean(false)); // Returns false\nutil.types.isBooleanObject(Boolean(true));  // Returns false\n```","summary":"Returns `true` if the value is a boolean object, e.g. created by `new Boolean()`.","examples":[{"language":"js","displayName":null,"code":"util.types.isBooleanObject(false);  // Returns false\nutil.types.isBooleanObject(true);   // Returns false\nutil.types.isBooleanObject(new Boolean(false)); // Returns true\nutil.types.isBooleanObject(new Boolean(true));  // Returns true\nutil.types.isBooleanObject(Boolean(false)); // Returns false\nutil.types.isBooleanObject(Boolean(true));  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisboxedprimitivevalue","name":"isBoxedPrimitive","title":"`util.types.isBoxedPrimitive(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.11.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is any boxed primitive object, e.g. created\nby `new Boolean()`, `new String()` or `Object(Symbol())`.\n\nFor example:\n\n```js\nutil.types.isBoxedPrimitive(false); // Returns false\nutil.types.isBoxedPrimitive(new Boolean(false)); // Returns true\nutil.types.isBoxedPrimitive(Symbol('foo')); // Returns false\nutil.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true\nutil.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true\n```","summary":"Returns `true` if the value is any boxed primitive object, e.g. created by `new Boolean()`, `new String()` or `Object(Symbol())`.","examples":[{"language":"js","displayName":null,"code":"util.types.isBoxedPrimitive(false); // Returns false\nutil.types.isBoxedPrimitive(new Boolean(false)); // Returns true\nutil.types.isBoxedPrimitive(Symbol('foo')); // Returns false\nutil.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true\nutil.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesiscryptokeyvalue","name":"isCryptoKey","title":"`util.types.isCryptoKey(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v16.2.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if `value` is a {CryptoKey}, `false` otherwise.","summary":"Returns `true` if `value` is a {CryptoKey}, `false` otherwise.","examples":[],"children":[]},{"kind":"method","id":"utiltypesisdataviewvalue","name":"isDataView","title":"`util.types.isDataView(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {DataView} instance.\n\n```js\nconst ab = new ArrayBuffer(20);\nutil.types.isDataView(new DataView(ab));  // Returns true\nutil.types.isDataView(new Float64Array());  // Returns false\n```\n\nSee also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).","summary":"Returns `true` if the value is a built-in {DataView} instance.","examples":[{"language":"js","displayName":null,"code":"const ab = new ArrayBuffer(20);\nutil.types.isDataView(new DataView(ab));  // Returns true\nutil.types.isDataView(new Float64Array());  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisdatevalue","name":"isDate","title":"`util.types.isDate(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Date} instance.\n\n```js\nutil.types.isDate(new Date());  // Returns true\n```","summary":"Returns `true` if the value is a built-in {Date} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isDate(new Date());  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisexternalvalue","name":"isExternal","title":"`util.types.isExternal(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a native `External` value.\n\nA native `External` value is a special type of object that contains a\nraw C++ pointer (`void*`) for access from native code, and has no other\nproperties. Such objects are created either by Node.js internals or native\naddons. In JavaScript, they are [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) objects with a\n`null` prototype.\n\n```c\n#include <js_native_api.h>\n#include <stdlib.h>\nnapi_value result;\nstatic napi_value MyNapi(napi_env env, napi_callback_info info) {\n  int* raw = (int*) malloc(1024);\n  napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &result);\n  if (status != napi_ok) {\n    napi_throw_error(env, NULL, \"napi_create_external failed\");\n    return NULL;\n  }\n  return result;\n}\n...\nDECLARE_NAPI_PROPERTY(\"myNapi\", MyNapi)\n...\n```\n\n```mjs\nimport native from 'napi_addon.node';\nimport { types } from 'node:util';\n\nconst data = native.myNapi();\ntypes.isExternal(data); // returns true\ntypes.isExternal(0); // returns false\ntypes.isExternal(new String('foo')); // returns false\n```\n\n```cjs\nconst native = require('napi_addon.node');\nconst { types } = require('node:util');\n\nconst data = native.myNapi();\ntypes.isExternal(data); // returns true\ntypes.isExternal(0); // returns false\ntypes.isExternal(new String('foo')); // returns false\n```\n\nFor further information on `napi_create_external`, refer to\n[`napi_create_external()`](n-api.html#napi_create_external).","summary":"Returns `true` if the value is a native `External` value.","examples":[{"language":"c","displayName":null,"code":"#include <js_native_api.h>\n#include <stdlib.h>\nnapi_value result;\nstatic napi_value MyNapi(napi_env env, napi_callback_info info) {\n  int* raw = (int*) malloc(1024);\n  napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &result);\n  if (status != napi_ok) {\n    napi_throw_error(env, NULL, \"napi_create_external failed\");\n    return NULL;\n  }\n  return result;\n}\n...\nDECLARE_NAPI_PROPERTY(\"myNapi\", MyNapi)\n..."},{"language":"mjs","displayName":null,"code":"import native from 'napi_addon.node';\nimport { types } from 'node:util';\n\nconst data = native.myNapi();\ntypes.isExternal(data); // returns true\ntypes.isExternal(0); // returns false\ntypes.isExternal(new String('foo')); // returns false"},{"language":"cjs","displayName":null,"code":"const native = require('napi_addon.node');\nconst { types } = require('node:util');\n\nconst data = native.myNapi();\ntypes.isExternal(data); // returns true\ntypes.isExternal(0); // returns false\ntypes.isExternal(new String('foo')); // returns false"}],"children":[]},{"kind":"method","id":"utiltypesisfloat16arrayvalue","name":"isFloat16Array","title":"`util.types.isFloat16Array(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v24.0.0","v22.16.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Float16Array} instance.\n\n```js\nutil.types.isFloat16Array(new ArrayBuffer());  // Returns false\nutil.types.isFloat16Array(new Float16Array());  // Returns true\nutil.types.isFloat16Array(new Float32Array());  // Returns false\n```","summary":"Returns `true` if the value is a built-in {Float16Array} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isFloat16Array(new ArrayBuffer());  // Returns false\nutil.types.isFloat16Array(new Float16Array());  // Returns true\nutil.types.isFloat16Array(new Float32Array());  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisfloat32arrayvalue","name":"isFloat32Array","title":"`util.types.isFloat32Array(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Float32Array} instance.\n\n```js\nutil.types.isFloat32Array(new ArrayBuffer());  // Returns false\nutil.types.isFloat32Array(new Float32Array());  // Returns true\nutil.types.isFloat32Array(new Float64Array());  // Returns false\n```","summary":"Returns `true` if the value is a built-in {Float32Array} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isFloat32Array(new ArrayBuffer());  // Returns false\nutil.types.isFloat32Array(new Float32Array());  // Returns true\nutil.types.isFloat32Array(new Float64Array());  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisfloat64arrayvalue","name":"isFloat64Array","title":"`util.types.isFloat64Array(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Float64Array} instance.\n\n```js\nutil.types.isFloat64Array(new ArrayBuffer());  // Returns false\nutil.types.isFloat64Array(new Uint8Array());  // Returns false\nutil.types.isFloat64Array(new Float64Array());  // Returns true\n```","summary":"Returns `true` if the value is a built-in {Float64Array} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isFloat64Array(new ArrayBuffer());  // Returns false\nutil.types.isFloat64Array(new Uint8Array());  // Returns false\nutil.types.isFloat64Array(new Float64Array());  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisgeneratorfunctionvalue","name":"isGeneratorFunction","title":"`util.types.isGeneratorFunction(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a generator function.\nThis only reports back what the JavaScript engine is seeing;\nin particular, the return value may not match the original source code if\na transpilation tool was used.\n\n```js\nutil.types.isGeneratorFunction(function foo() {});  // Returns false\nutil.types.isGeneratorFunction(function* foo() {});  // Returns true\n```","summary":"Returns `true` if the value is a generator function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used.","examples":[{"language":"js","displayName":null,"code":"util.types.isGeneratorFunction(function foo() {});  // Returns false\nutil.types.isGeneratorFunction(function* foo() {});  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisgeneratorobjectvalue","name":"isGeneratorObject","title":"`util.types.isGeneratorObject(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a generator object as returned from a\nbuilt-in generator function.\nThis only reports back what the JavaScript engine is seeing;\nin particular, the return value may not match the original source code if\na transpilation tool was used.\n\n```js\nfunction* foo() {}\nconst generator = foo();\nutil.types.isGeneratorObject(generator);  // Returns true\n```","summary":"Returns `true` if the value is a generator object as returned from a built-in generator function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used.","examples":[{"language":"js","displayName":null,"code":"function* foo() {}\nconst generator = foo();\nutil.types.isGeneratorObject(generator);  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisint8arrayvalue","name":"isInt8Array","title":"`util.types.isInt8Array(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Int8Array} instance.\n\n```js\nutil.types.isInt8Array(new ArrayBuffer());  // Returns false\nutil.types.isInt8Array(new Int8Array());  // Returns true\nutil.types.isInt8Array(new Float64Array());  // Returns false\n```","summary":"Returns `true` if the value is a built-in {Int8Array} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isInt8Array(new ArrayBuffer());  // Returns false\nutil.types.isInt8Array(new Int8Array());  // Returns true\nutil.types.isInt8Array(new Float64Array());  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisint16arrayvalue","name":"isInt16Array","title":"`util.types.isInt16Array(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Int16Array} instance.\n\n```js\nutil.types.isInt16Array(new ArrayBuffer());  // Returns false\nutil.types.isInt16Array(new Int16Array());  // Returns true\nutil.types.isInt16Array(new Float64Array());  // Returns false\n```","summary":"Returns `true` if the value is a built-in {Int16Array} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isInt16Array(new ArrayBuffer());  // Returns false\nutil.types.isInt16Array(new Int16Array());  // Returns true\nutil.types.isInt16Array(new Float64Array());  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisint32arrayvalue","name":"isInt32Array","title":"`util.types.isInt32Array(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Int32Array} instance.\n\n```js\nutil.types.isInt32Array(new ArrayBuffer());  // Returns false\nutil.types.isInt32Array(new Int32Array());  // Returns true\nutil.types.isInt32Array(new Float64Array());  // Returns false\n```","summary":"Returns `true` if the value is a built-in {Int32Array} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isInt32Array(new ArrayBuffer());  // Returns false\nutil.types.isInt32Array(new Int32Array());  // Returns true\nutil.types.isInt32Array(new Float64Array());  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesiskeyobjectvalue","name":"isKeyObject","title":"`util.types.isKeyObject(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v16.2.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if `value` is a {KeyObject}, `false` otherwise.","summary":"Returns `true` if `value` is a {KeyObject}, `false` otherwise.","examples":[],"children":[]},{"kind":"method","id":"utiltypesismapvalue","name":"isMap","title":"`util.types.isMap(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Map} instance.\n\n```js\nutil.types.isMap(new Map());  // Returns true\n```","summary":"Returns `true` if the value is a built-in {Map} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isMap(new Map());  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesismapiteratorvalue","name":"isMapIterator","title":"`util.types.isMapIterator(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is an iterator returned for a built-in\n{Map} instance.\n\n```js\nconst map = new Map();\nutil.types.isMapIterator(map.keys());  // Returns true\nutil.types.isMapIterator(map.values());  // Returns true\nutil.types.isMapIterator(map.entries());  // Returns true\nutil.types.isMapIterator(map[Symbol.iterator]());  // Returns true\n```","summary":"Returns `true` if the value is an iterator returned for a built-in {Map} instance.","examples":[{"language":"js","displayName":null,"code":"const map = new Map();\nutil.types.isMapIterator(map.keys());  // Returns true\nutil.types.isMapIterator(map.values());  // Returns true\nutil.types.isMapIterator(map.entries());  // Returns true\nutil.types.isMapIterator(map[Symbol.iterator]());  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesismodulenamespaceobjectvalue","name":"isModuleNamespaceObject","title":"`util.types.isModuleNamespaceObject(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is an instance of a [Module Namespace Object](https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects).\n\n```mjs\nimport * as ns from './a.js';\n\nutil.types.isModuleNamespaceObject(ns);  // Returns true\n```","summary":"Returns `true` if the value is an instance of a Module Namespace Object.","examples":[{"language":"mjs","displayName":null,"code":"import * as ns from './a.js';\n\nutil.types.isModuleNamespaceObject(ns);  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisnativeerrorvalue","name":"isNativeError","title":"`util.types.isNativeError(value)`","scope":"module","overloadOf":null,"stability":{"index":"0","description":"Deprecated: Use [`Error.isError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/isError) instead."},"added":["v10.0.0"],"deprecated":["v24.2.0"],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"**Note:** As of Node.js 24, `Error.isError()` is currently slower than `util.types.isNativeError()`.\nIf performance is critical, consider benchmarking both in your environment.\n\nReturns `true` if the value was returned by the constructor of a\n[built-in `Error` type](https://tc39.es/ecma262/#sec-error-objects).\n\n```js\nconsole.log(util.types.isNativeError(new Error()));  // true\nconsole.log(util.types.isNativeError(new TypeError()));  // true\nconsole.log(util.types.isNativeError(new RangeError()));  // true\n```\n\nSubclasses of the native error types are also native errors:\n\n```js\nclass MyError extends Error {}\nconsole.log(util.types.isNativeError(new MyError()));  // true\n```\n\nA value being `instanceof` a native error class is not equivalent to `isNativeError()`\nreturning `true` for that value. `isNativeError()` returns `true` for errors\nwhich come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false`\nfor these errors:\n\n```mjs\nimport { createContext, runInContext } from 'node:vm';\nimport { types } from 'node:util';\n\nconst context = createContext({});\nconst myError = runInContext('new Error()', context);\nconsole.log(types.isNativeError(myError)); // true\nconsole.log(myError instanceof Error); // false\n```\n\n```cjs\nconst { createContext, runInContext } = require('node:vm');\nconst { types } = require('node:util');\n\nconst context = createContext({});\nconst myError = runInContext('new Error()', context);\nconsole.log(types.isNativeError(myError)); // true\nconsole.log(myError instanceof Error); // false\n```\n\nConversely, `isNativeError()` returns `false` for all objects which were not\nreturned by the constructor of a native error. That includes values\nwhich are `instanceof` native errors:\n\n```js\nconst myError = { __proto__: Error.prototype };\nconsole.log(util.types.isNativeError(myError)); // false\nconsole.log(myError instanceof Error); // true\n```","summary":"**Note:** As of Node.js 24, `Error.isError()` is currently slower than `util.types.isNativeError()`. If performance is critical, consider benchmarking both in your environment.","examples":[{"language":"js","displayName":null,"code":"console.log(util.types.isNativeError(new Error()));  // true\nconsole.log(util.types.isNativeError(new TypeError()));  // true\nconsole.log(util.types.isNativeError(new RangeError()));  // true"},{"language":"js","displayName":null,"code":"class MyError extends Error {}\nconsole.log(util.types.isNativeError(new MyError()));  // true"},{"language":"mjs","displayName":null,"code":"import { createContext, runInContext } from 'node:vm';\nimport { types } from 'node:util';\n\nconst context = createContext({});\nconst myError = runInContext('new Error()', context);\nconsole.log(types.isNativeError(myError)); // true\nconsole.log(myError instanceof Error); // false"},{"language":"cjs","displayName":null,"code":"const { createContext, runInContext } = require('node:vm');\nconst { types } = require('node:util');\n\nconst context = createContext({});\nconst myError = runInContext('new Error()', context);\nconsole.log(types.isNativeError(myError)); // true\nconsole.log(myError instanceof Error); // false"},{"language":"js","displayName":null,"code":"const myError = { __proto__: Error.prototype };\nconsole.log(util.types.isNativeError(myError)); // false\nconsole.log(myError instanceof Error); // true"}],"children":[]},{"kind":"method","id":"utiltypesisnumberobjectvalue","name":"isNumberObject","title":"`util.types.isNumberObject(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a number object, e.g. created\nby `new Number()`.\n\n```js\nutil.types.isNumberObject(0);  // Returns false\nutil.types.isNumberObject(new Number(0));   // Returns true\n```","summary":"Returns `true` if the value is a number object, e.g. created by `new Number()`.","examples":[{"language":"js","displayName":null,"code":"util.types.isNumberObject(0);  // Returns false\nutil.types.isNumberObject(new Number(0));   // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesispromisevalue","name":"isPromise","title":"`util.types.isPromise(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Promise}.\n\n```js\nutil.types.isPromise(Promise.resolve(42));  // Returns true\n```","summary":"Returns `true` if the value is a built-in {Promise}.","examples":[{"language":"js","displayName":null,"code":"util.types.isPromise(Promise.resolve(42));  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisproxyvalue","name":"isProxy","title":"`util.types.isProxy(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a {Proxy} instance.\n\n```js\nconst target = {};\nconst proxy = new Proxy(target, {});\nutil.types.isProxy(target);  // Returns false\nutil.types.isProxy(proxy);  // Returns true\n```","summary":"Returns `true` if the value is a {Proxy} instance.","examples":[{"language":"js","displayName":null,"code":"const target = {};\nconst proxy = new Proxy(target, {});\nutil.types.isProxy(target);  // Returns false\nutil.types.isProxy(proxy);  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisregexpvalue","name":"isRegExp","title":"`util.types.isRegExp(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a regular expression object.\n\n```js\nutil.types.isRegExp(/abc/);  // Returns true\nutil.types.isRegExp(new RegExp('abc'));  // Returns true\n```","summary":"Returns `true` if the value is a regular expression object.","examples":[{"language":"js","displayName":null,"code":"util.types.isRegExp(/abc/);  // Returns true\nutil.types.isRegExp(new RegExp('abc'));  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesissetvalue","name":"isSet","title":"`util.types.isSet(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Set} instance.\n\n```js\nutil.types.isSet(new Set());  // Returns true\n```","summary":"Returns `true` if the value is a built-in {Set} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isSet(new Set());  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesissetiteratorvalue","name":"isSetIterator","title":"`util.types.isSetIterator(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is an iterator returned for a built-in\n{Set} instance.\n\n```js\nconst set = new Set();\nutil.types.isSetIterator(set.keys());  // Returns true\nutil.types.isSetIterator(set.values());  // Returns true\nutil.types.isSetIterator(set.entries());  // Returns true\nutil.types.isSetIterator(set[Symbol.iterator]());  // Returns true\n```","summary":"Returns `true` if the value is an iterator returned for a built-in {Set} instance.","examples":[{"language":"js","displayName":null,"code":"const set = new Set();\nutil.types.isSetIterator(set.keys());  // Returns true\nutil.types.isSetIterator(set.values());  // Returns true\nutil.types.isSetIterator(set.entries());  // Returns true\nutil.types.isSetIterator(set[Symbol.iterator]());  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesissharedarraybuffervalue","name":"isSharedArrayBuffer","title":"`util.types.isSharedArrayBuffer(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {SharedArrayBuffer} instance.\nThis does *not* include {ArrayBuffer} instances. Usually, it is\ndesirable to test for both; See [`util.types.isAnyArrayBuffer()`](#utiltypesisanyarraybuffervalue) for that.\n\n```js\nutil.types.isSharedArrayBuffer(new ArrayBuffer());  // Returns false\nutil.types.isSharedArrayBuffer(new SharedArrayBuffer());  // Returns true\n```","summary":"Returns `true` if the value is a built-in {SharedArrayBuffer} instance. This does _not_ include {ArrayBuffer} instances. Usually, it is desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.","examples":[{"language":"js","displayName":null,"code":"util.types.isSharedArrayBuffer(new ArrayBuffer());  // Returns false\nutil.types.isSharedArrayBuffer(new SharedArrayBuffer());  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisstringobjectvalue","name":"isStringObject","title":"`util.types.isStringObject(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a string object, e.g. created\nby `new String()`.\n\n```js\nutil.types.isStringObject('foo');  // Returns false\nutil.types.isStringObject(new String('foo'));   // Returns true\n```","summary":"Returns `true` if the value is a string object, e.g. created by `new String()`.","examples":[{"language":"js","displayName":null,"code":"util.types.isStringObject('foo');  // Returns false\nutil.types.isStringObject(new String('foo'));   // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesissymbolobjectvalue","name":"isSymbolObject","title":"`util.types.isSymbolObject(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a symbol object, created\nby calling `Object()` on a `Symbol` primitive.\n\n```js\nconst symbol = Symbol('foo');\nutil.types.isSymbolObject(symbol);  // Returns false\nutil.types.isSymbolObject(Object(symbol));   // Returns true\n```","summary":"Returns `true` if the value is a symbol object, created by calling `Object()` on a `Symbol` primitive.","examples":[{"language":"js","displayName":null,"code":"const symbol = Symbol('foo');\nutil.types.isSymbolObject(symbol);  // Returns false\nutil.types.isSymbolObject(Object(symbol));   // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesistypedarrayvalue","name":"isTypedArray","title":"`util.types.isTypedArray(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {TypedArray} instance.\n\n```js\nutil.types.isTypedArray(new ArrayBuffer());  // Returns false\nutil.types.isTypedArray(new Uint8Array());  // Returns true\nutil.types.isTypedArray(new Float64Array());  // Returns true\n```\n\nSee also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).","summary":"Returns `true` if the value is a built-in {TypedArray} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isTypedArray(new ArrayBuffer());  // Returns false\nutil.types.isTypedArray(new Uint8Array());  // Returns true\nutil.types.isTypedArray(new Float64Array());  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisuint8arrayvalue","name":"isUint8Array","title":"`util.types.isUint8Array(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Uint8Array} instance.\n\n```js\nutil.types.isUint8Array(new ArrayBuffer());  // Returns false\nutil.types.isUint8Array(new Uint8Array());  // Returns true\nutil.types.isUint8Array(new Float64Array());  // Returns false\n```","summary":"Returns `true` if the value is a built-in {Uint8Array} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isUint8Array(new ArrayBuffer());  // Returns false\nutil.types.isUint8Array(new Uint8Array());  // Returns true\nutil.types.isUint8Array(new Float64Array());  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisuint8clampedarrayvalue","name":"isUint8ClampedArray","title":"`util.types.isUint8ClampedArray(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Uint8ClampedArray} instance.\n\n```js\nutil.types.isUint8ClampedArray(new ArrayBuffer());  // Returns false\nutil.types.isUint8ClampedArray(new Uint8ClampedArray());  // Returns true\nutil.types.isUint8ClampedArray(new Float64Array());  // Returns false\n```","summary":"Returns `true` if the value is a built-in {Uint8ClampedArray} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isUint8ClampedArray(new ArrayBuffer());  // Returns false\nutil.types.isUint8ClampedArray(new Uint8ClampedArray());  // Returns true\nutil.types.isUint8ClampedArray(new Float64Array());  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisuint16arrayvalue","name":"isUint16Array","title":"`util.types.isUint16Array(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Uint16Array} instance.\n\n```js\nutil.types.isUint16Array(new ArrayBuffer());  // Returns false\nutil.types.isUint16Array(new Uint16Array());  // Returns true\nutil.types.isUint16Array(new Float64Array());  // Returns false\n```","summary":"Returns `true` if the value is a built-in {Uint16Array} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isUint16Array(new ArrayBuffer());  // Returns false\nutil.types.isUint16Array(new Uint16Array());  // Returns true\nutil.types.isUint16Array(new Float64Array());  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisuint32arrayvalue","name":"isUint32Array","title":"`util.types.isUint32Array(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {Uint32Array} instance.\n\n```js\nutil.types.isUint32Array(new ArrayBuffer());  // Returns false\nutil.types.isUint32Array(new Uint32Array());  // Returns true\nutil.types.isUint32Array(new Float64Array());  // Returns false\n```","summary":"Returns `true` if the value is a built-in {Uint32Array} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isUint32Array(new ArrayBuffer());  // Returns false\nutil.types.isUint32Array(new Uint32Array());  // Returns true\nutil.types.isUint32Array(new Float64Array());  // Returns false"}],"children":[]},{"kind":"method","id":"utiltypesisweakmapvalue","name":"isWeakMap","title":"`util.types.isWeakMap(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {WeakMap} instance.\n\n```js\nutil.types.isWeakMap(new WeakMap());  // Returns true\n```","summary":"Returns `true` if the value is a built-in {WeakMap} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isWeakMap(new WeakMap());  // Returns true"}],"children":[]},{"kind":"method","id":"utiltypesisweaksetvalue","name":"isWeakSet","title":"`util.types.isWeakSet(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Returns `true` if the value is a built-in {WeakSet} instance.\n\n```js\nutil.types.isWeakSet(new WeakSet());  // Returns true\n```","summary":"Returns `true` if the value is a built-in {WeakSet} instance.","examples":[{"language":"js","displayName":null,"code":"util.types.isWeakSet(new WeakSet());  // Returns true"}],"children":[]}]},{"kind":"section","id":"deprecated-apis","name":"Deprecated APIs","title":"Deprecated APIs","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The following APIs are deprecated and should no longer be used. Existing\napplications and modules should be updated to find alternative approaches.","summary":"The following APIs are deprecated and should no longer be used. Existing applications and modules should be updated to find alternative approaches.","examples":[],"children":[{"kind":"method","id":"util_extendtarget-source","name":"_extend","title":"`util._extend(target, source)`","scope":"module","overloadOf":null,"stability":{"index":"0","description":"Deprecated: Use [`Object.assign()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) instead."},"added":["v0.7.5"],"deprecated":["v6.0.0"],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"target","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"source","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"The `util._extend()` method was never intended to be used outside of internal\nNode.js modules. The community found and used it anyway.\n\nIt is deprecated and should not be used in new code. JavaScript comes with very\nsimilar built-in functionality through [`Object.assign()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign).\n\nAn automated migration is available ([source](https://github.com/nodejs/userland-migrations/tree/main/recipes/util-extend-to-object-assign)):\n\n```bash\nnpx codemod@latest @nodejs/util-extend-to-object-assign\n```","summary":"The `util._extend()` method was never intended to be used outside of internal Node.js modules. The community found and used it anyway.","examples":[{"language":"bash","displayName":null,"code":"npx codemod@latest @nodejs/util-extend-to-object-assign"}],"children":[]},{"kind":"method","id":"utilisarrayobject","name":"isArray","title":"`util.isArray(object)`","scope":"module","overloadOf":null,"stability":{"index":"0","description":"Deprecated: Use [`Array.isArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray) instead."},"added":["v0.6.0"],"deprecated":["v4.0.0"],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"object","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Alias for [`Array.isArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray).\n\nReturns `true` if the given `object` is an `Array`. Otherwise, returns `false`.\n\n```js\nconst util = require('node:util');\n\nutil.isArray([]);\n// Returns: true\nutil.isArray(new Array());\n// Returns: true\nutil.isArray({});\n// Returns: false\n```\n\nAn automated migration is available ([source](https://github.com/nodejs/userland-migrations/tree/main/recipes/util-is)):\n\n```bash\nnpx codemod@latest @nodejs/util-is\n```","summary":"Alias for `Array.isArray()`.","examples":[{"language":"js","displayName":null,"code":"const util = require('node:util');\n\nutil.isArray([]);\n// Returns: true\nutil.isArray(new Array());\n// Returns: true\nutil.isArray({});\n// Returns: false"},{"language":"bash","displayName":null,"code":"npx codemod@latest @nodejs/util-is"}],"children":[]}]}]}