Node.js module

async_hooks

The 'node:async_hooks' module provides hooks to track the lifecycle of asynchronous resources in Node.js—init, before, after, and destroy—for tasks like promises, timers, callbacks, and I/O operations.

It's useful for keeping state across async callbacks, measuring performance, or building custom logging and tracing tools in your application.

Works in Bun · notes

AsyncLocalStorage and AsyncResource are implemented. However, v8 promise hooks required for broader compatibility are not called.

Functions 4

Classes 2

Interfaces 5

Namespaces 1