Open this example in the interactive library
Source code
import * as util from "node:util";
console.log(
await new Promise((resolve) =>
util.callbackify(async () => 42)((err, value) => resolve(value)),
),
);
Sample output
42

Open this example in the interactive library
import * as util from "node:util";
console.log(
await new Promise((resolve) =>
util.callbackify(async () => 42)((err, value) => resolve(value)),
),
);
42