cls-q

JSON →
library 1.1.0 ·javascript deprecated
verified Jun 7, 2026

A shim that patches Q promises to preserve continuation-local storage (CLS) contexts when calling promise.then(). Specifically designed to fix interoperability issues between Q and modules like node-redis that perform non-standard async operations. Current version 1.1.0 (last release). Works by binding callbacks to ensure the active CLS namespace is propagated. Supports binding to multiple namespaces, but with performance overhead. Requires peer dependencies `continuation-local-storage` ~3.x and `q` >=0.9.7. Lightweight (~50 lines) but only suitable for legacy Q-based codebases; modern users should migrate to native promises or async/await.