Continuation-Local Storage (Userland)

JSON →
library 3.2.1 ·javascript abandoned
verified May 27, 2026

This package provides a userland implementation of Continuation-Local Storage (CLS) for Node.js, a mechanism akin to thread-local storage but adapted for Node's asynchronous callback chains. It allows developers to store and retrieve values that are scoped to the lifetime of a sequence of asynchronous function calls, eliminating the need to explicitly pass context objects (like request IDs or user information) through numerous function parameters. Values are managed within named 'namespaces' using `createNamespace()`, `getNamespace()`, and propagating context via `namespace.run()` or `namespace.bind()`. While a valuable concept, this specific `continuation-local-storage` package (version 3.2.1, last published 8 years ago) is considered superseded. Modern Node.js applications should leverage the native `AsyncLocalStorage` API (available since Node.js v13.10.0, backported to v12) for a more robust and performant solution, or `cls-hooked` for older Node.js versions, both of which utilize `async_hooks`.

total hits 40
actors 8 distinct systems
last hit 17h ago human
ByteDance
11
Amazonbot
4
MetaBot
4
GPTBot
2
Script
1
ClaudeBot
1
Humans
9

top countries 🇺🇸 United States · 🇸🇬 Singapore · 🇩🇪 Germany · VN · 🇨🇦 Canada