Debug object state
Create readable representations of objects while debugging backend code.
Node.js · Module
The node:util module provides built-in helpers for Node.js internals and application code. It includes formatting, inspection, debugging, type checks, and other common utility APIs.
The node:util module provides general-purpose helpers used by Node.js internals and application or module developers. Its APIs include debugging output, object inspection, formatting, type checks, deprecation wrappers, and promise-to-callback adaptation.
import util from 'node:util';
const util = require('node:util');A namespace containing Node.js utility APIs.
node:util is a built-in module whose utilities are also useful to application and module developers.node:-prefixed specifier.require('node:util').types export supplies checks for categories of built-in objects.types namespace or its dedicated subpath, not only through the top-level module.import util from 'node:util';
const user = { id: 7, name: 'Ada' };
console.log(util.inspect(user, { colors: false }));Loads the built-in module and produces a readable debugging representation of an object.
Create readable representations of objects while debugging backend code.
Format values for diagnostic messages and logs.
Check whether values are instances of built-in Node.js types.
Adapt callback-based and promise-based APIs at integration boundaries.
util.typesutil.format()util.inspect()util.debuglog()util.deprecate()util.promisify()util.callbackify()util.parseArgs()