process.exit()

A Node.js function that ends the process at once with the exit code you give, skipping any work still waiting on the event loop.

In more detail

Pending writes and timers are dropped, so call it only after cleanup has finished. Setting process.exitCode and letting the loop empty is the gentler way to exit.

Related terms

Taught in

References