
Security News
Next.js Patches Critical Middleware Vulnerability (CVE-2025-29927)
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
Gracefully clean up your program at termination with multiple sync and/or async handlers. Wraps the `death` npm module.
diehard
Diehard is a node.js module that helps you gracefully clean up your program at termination with multiple sync and/or async handlers. Wraps the death
npm module.
death
is an incredibly useful module that abstracts out the need to handle the various kinds of termination events, but ultimately only supports a single handler. I've found that in more complex projects you often have multiple loose ends to clean up, and I desired a solution that would allow me to properly isolate the responsibility for cleaning up each individual resource into dedicated handlers that would are run in parallel. diehard
solves that problem.
$ npm install diehard
var diehard = require('diehard');
setInterval(function () {
console.log('Blah blah blah.'); // keeps running until we CTRL+C
}, 250);
diehard.register(function () {
//TODO: clean up some resource
// this is a synchronous handler
});
diehard.register(function (done) {
//TODO: clean up some resource
done(); // async, ftw!
});
diehard.register(function (signal, done) {
//TODO: clean up some resource
// we also have the `signal` that terminated the process here, in case we care
done();
});
diehard.register(function (signal, uncaughtErr, done) {
//TODO: clean up some resource
// if an uncaught error was the reason the process is terminating, we can access that, too
done();
});
diehard.listen();
In the above example, all five termination handlers will be run (in parallel) before the process exits.
FAQs
Gracefully clean up your program at termination with multiple sync and/or async handlers. Wraps the `death` npm module.
The npm package diehard receives a total of 566 weekly downloads. As such, diehard popularity was classified as not popular.
We found that diehard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.