🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

finis

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

finis

hook node exit with your callback, get `exit code` and `signal name` from parameters

Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

finis

Run your callback before node exit, pass exit code and signal name as parameters

Installation

npm install finis --save

Usage

finis() installs a callback function which will be run just before the node process exits.

The callback function will be called when:

  • the process exits normally
  • the user presses Ctrl+C
  • an exception is uncaught

You may call finis() multiple times to install multiple callback functions.

var finis = require('finis')

finis((code, signal, error) => {
  console.log(`finis(${code}, ${signal}, ${error})`)
})

Credit

This code was forked from @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.

Keywords

node

FAQs

Package last updated on 09 Dec 2016

Did you know?

Socket

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.

Install

Related posts