AsyncLocalStorage

A Node.js class that keeps a value, such as the current request's ID, available to every function called during one asynchronous operation, without passing it as an argument.

In more detail

als.run(store, fn) makes store visible through als.getStore() inside fn and in every callback, timer and promise continuation it causes. Concurrent requests each see only their own store, so it is the usual base for request-scoped logging and tracing.

Related terms

Taught in

References