I want to tell Node.js to always do something just before it exits, for whatever reason — Ctrl+C, an exception, or any other reason.
I tried th
Just wanted to mention death package here: https://github.com/jprichardson/node-death
death
Example:
var ON_DEATH = require('death')({uncaughtException: true}); //this is intentionally ugly ON_DEATH(function(signal, err) { //clean up code here })