@hypercliq/shutdown-cleanup
TypeScript icon, indicating that this package has built-in type declarations

6.0.4 • Public • Published

Shutdown-Cleanup Module

npm npm NPM

The shutdown-cleanup module provides a structured approach for managing graceful shutdowns in Node.js applications. It supports phased shutdowns, signal-specific handlers, customizable error handling strategies, and custom exit codes, ensuring broad compatibility with LTS Node.js versions.

Features

  • Phased Shutdown: Organizes shutdown logic into phases for orderly execution.
  • Signal-Specific Handlers: Custom logic for specific signals without mandatory shutdown.
  • Error Handling Strategy: Customizable handling of handler errors.
  • Custom Exit Codes: Specify exit codes to indicate shutdown statuses.
  • Graceful Shutdown with Timeout: Prevents indefinite hangs during shutdown. (See Developer Guide for details.)
  • LTS Node.js Support: Compatible with LTS Node.js versions.
  • Enhanced Flexibility: Supports handling of custom application events.
  • TypeScript Support: Includes TypeScript definitions for ease of development.

Installation

npm install @hypercliq/shutdown-cleanup

Or using Yarn:

yarn add @hypercliq/shutdown-cleanup

Usage

To use shutdown-cleanup, import and utilize its functions within your application to manage shutdown logic effectively.

import { registerHandler } from "@hypercliq/shutdown-cleanup";

registerHandler(async (signal) => {
  await performCleanup();
  console.log("Cleanup completed");
});

Examples and Best Practices

For more detailed usage examples and best practices, see the Developer Guide.

Contributing

Contributions are welcome! Please submit issues and pull requests to propose changes, report bugs, or suggest new features. For major changes, open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Package Sidebar

Install

npm i @hypercliq/shutdown-cleanup

Weekly Downloads

97

Version

6.0.4

License

MIT

Unpacked Size

15.3 kB

Total Files

5

Last publish

Collaborators

  • msanguineti