Skip to main content

Difference between async resource vs async operation in Node internals?

Expert NodeJS
Quick Answer An async resource (in async_hooks terms) is the object that represents the context of an async operation รขโ‚ฌโ€ it's created when you initiate an async task and tracks its lifecycle (init, before, after, destroy). An async operation is the actual work happening asynchronously (I/O read, timer, Promise resolution). The resource wraps the operation for tracking.

Answer

Async resources track handles like sockets or timers. Async operations are actions performed by these resources. Distinguishing them aids context tracking.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice