
Security News
New React Server Components Vulnerabilities: DoS and Source Code Exposure
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.
Node.js program finisher - run your last callback with `exit code` and `signal name` as arguments
Run your callback before node exit, pass exit code and signal name as arguments
npm install finis --save
finis() installs a callback function which will be run just before the node process exits.
The callback function will be called when:
const { finis } = require('finis')
finis((code, signal, error) => {
console.log(`finis(${code}, ${signal}, ${error})`)
})
import { finis } from 'finis'
finis((code: number, signal: 'exit'|'SIGINT'|'uncaughtException', error?: Error) => {
console.log(`finis(${code}, ${signal}, ${error})`)
})
You may call finis() multiple times to install multiple callback functions.
This module is inspired by @jtlapp/node-cleanup, which is borrowed and modified from CanyonCasa's answer to a stackoverflow question. I found the code necessary for all my node projects. See the stackoverflow answer for more examples of use.
FAQs
Node.js program finisher - run your last callback with `exit code` and `signal name` as arguments
The npm package finis receives a total of 70 weekly downloads. As such, finis popularity was classified as not popular.
We found that finis 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
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.