An async hooks-based thread-local-like storage for Node.js, providing per-call-chain context propagation. Version 2.3.1 supports Node >=8.0.0 using async_hooks. It offers scopable storage, linked top behavior, and create time tracking. Compared to alternatives like cls-hooked or async_hooks directly, it provides a simpler API but lacks built-in automatic cleanup and has known performance overhead. Last updated in 2018; no active maintenance observed.
npm install async-local-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage: enable async hooks, create a scope, set and get a value within the same call chain.
Call als.enable() once at startup before any async operations.
Use scope() only when you want a fresh context; otherwise skip it.
Consider alternatives like cls-hooked or AsyncLocalStorage (built-in in Node 12+).
Use linkedTop only when you explicitly want to share across sub-chains.
Add const als = require('async-local-storage'); or import als from 'async-local-storage';Use const als = require('async-local-storage'); als.enable();Ensure als.enable() is called before any async operations and scope() is used appropriately.
Run npm install async-local-storage
Upgrade Node to >=8.0.0 or use a different library that does not rely on async_hooks.
No dependency data recorded yet.