Many older Node APIs (and some libraries) still use error-first callbacks. `util.promisify` wraps such a function into one that returns a Promise, so it can be used with `await`.
js
import { promisify } from "node:util";
import { exec } from "node:child_process";
const execAsync = promisify(exec);
const { stdout } = await execAsync("node --version");
console.log(stdout.trim());`promisify` expects the wrapped function's last argument to be a standard `(err, result)` callback; functions that call back with multiple result values (or don't follow the convention) need a small manual wrapper instead.