Node.js · Middle · Question 72 of 75
What is AsyncLocalStorage used for?
- ✓Correct answer: Keeping per-request data (like a request ID or user) available across
awaits and callbacks without passing it through every function - 2Sharing memory between worker threads
- 3Storing data on disk between restarts
Explanation
Call storage.run(context, handler) at the start of a request; any code it calls, sync or async, can read the context with storage.getStore().