{"id":20542263,"url":"https://github.com/darkobits/adeiu","last_synced_at":"2026-06-06T15:31:57.271Z","repository":{"id":34735607,"uuid":"182032537","full_name":"darkobits/adeiu","owner":"darkobits","description":"Même les procédés les plus délicieux seront également appelés à mourir un jour.","archived":false,"fork":false,"pushed_at":"2024-02-01T17:37:41.000Z","size":2896,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-17T14:17:49.055Z","etag":null,"topics":["bad-french","cleanup","death","exit","shutdown","signals"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darkobits.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-18T06:50:54.000Z","updated_at":"2023-07-10T12:52:34.000Z","dependencies_parsed_at":"2024-06-21T17:33:28.024Z","dependency_job_id":"4d6899f8-f5e8-46d3-a457-e5a96d86dbe7","html_url":"https://github.com/darkobits/adeiu","commit_stats":{"total_commits":79,"total_committers":5,"mean_commits":15.8,"dds":"0.36708860759493667","last_synced_commit":"93da11df6d72a490aeb4501eda2ef0b2e8c39054"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkobits%2Fadeiu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkobits%2Fadeiu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkobits%2Fadeiu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkobits%2Fadeiu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darkobits","download_url":"https://codeload.github.com/darkobits/adeiu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242147464,"owners_count":20079546,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bad-french","cleanup","death","exit","shutdown","signals"],"created_at":"2024-11-16T01:30:17.466Z","updated_at":"2025-03-06T04:27:03.076Z","avatar_url":"https://github.com/darkobits.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource\n      media=\"(prefers-color-scheme: dark)\"\n      srcset=\"https://github.com/darkobits/adeiu/assets/441546/5639dd58-3a6f-4015-98a9-14da5e22a97e\"\n      width=\"100%\"\n    \u003e\n    \u003cimg\n      src=\"https://github.com/darkobits/adeiu/assets/441546/80c6679d-1419-4e15-a7f7-480e51c97511\"\n      width=\"100%\"\n    \u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca\n    href=\"https://www.npmjs.com/package/@darkobits/adeiu\"\n  \u003e\u003cimg\n    src=\"https://img.shields.io/npm/v/@darkobits/adeiu.svg?style=flat-square\"\n  \u003e\u003c/a\u003e\n  \u003ca\n    href=\"https://github.com/darkobits/adeiu/actions?query=workflow%3Aci\"\n  \u003e\u003cimg\n    src=\"https://img.shields.io/github/actions/workflow/status/darkobits/adeiu/ci.yml?style=flat-square\"\n  \u003e\u003c/a\u003e\n  \u003ca\n    href=\"https://app.codecov.io/gh/darkobits/adeiu\"\n  \u003e\u003cimg\n    src=\"https://img.shields.io/codecov/c/github/darkobits/adeiu?style=flat-square\u0026color=%2346CC10\"\n  \u003e\u003c/a\u003e\n  \u003ca\n    href=\"https://depfu.com/repos/github/darkobits/adeiu\"\n  \u003e\u003cimg\n    src=\"https://img.shields.io/depfu/darkobits/adeiu?style=flat-square\"\n  \u003e\u003c/a\u003e\n  \u003ca\n    href=\"https://conventionalcommits.org\"\n  \u003e\u003cimg\n    src=\"https://img.shields.io/static/v1?label=commits\u0026message=conventional\u0026style=flat-square\u0026color=398AFB\"\n  \u003e\u003c/a\u003e\n  \u003ca\n    href=\"https://firstdonoharm.dev\"\n  \u003e\u003cimg\n    src=\"https://img.shields.io/static/v1?label=license\u0026message=hippocratic\u0026style=flat-square\u0026color=753065\"\n  \u003e\u003c/a\u003e\n\u003c/p\u003e\n\nAdeiu is a POSIX signal handler designed to for applications with asynchronous cleanup / shutdown\nrequirements, such as gracefully shutting-down an HTTP server or closing a database connection.\n\n## Features\n\n* Zero dependencies.\n* Ensures provided handlers are called before any other event listeners and are run concurrently,\n  minimizing shutdown time.\n* Works with any combination of synchronous and asynchronous handlers.\n* Automatically exits with code `0` once all handlers resolve/return, or `1` if any reject/throw.\n* Supports edge cases related to the Node debugger being attached to a process. (See [this issue](https://github.com/nodejs/node/issues/7742))\n\n## Install\n\n```\nnpm i @darkobits/adeiu\n```\n\n## Use\n\n```ts\nadeiu(handler: AdeiuHandler, options?: AdeiuOptions): () =\u003e void\n```\n\nAdeiu accepts an asynchronous or synchronous handler function and returns an unregister function. By\ndefault, the handler will be registered to respond to the following signals:\n\n* `SIGINT`\n* `SIGQUIT`\n* `SIGTERM`\n* `SIGUSR2`\n\n```ts\nimport adeiu from '@darkobits/adeiu'\n\nconst unregister = adeiu(async signal =\u003e {\n  console.log(`Received signal ${signal}; shutting down...`)\n  await asyncCleanup()\n  console.log('Done.')\n})\n```\n\nIf multiple handlers are registered, they will be invoked in parallel.\n\n### Customizing Signals\n\nUsually, responding to signals dynamically can be accomplished by inspecting the `signal` argument\npassed to your handler. However, if it is important that handlers are _only_ installed for a particular\nsignal, or if you'd like to respond to signals other than the defaults, you may optionally provide an\narray of signals:\n\n```ts\nimport adeiu from '@darkobits/adeiu'\n\n// Register handler that will _only_ be invoked on SIGINT:\nadeiu(() =\u003e {\n  // ...\n}, { signals: ['SIGINT'] })\n```\n\n```ts\nimport adeiu, { DEFAULT_SIGNALS } from '@darkobits/adeiu'\n\n// Register handler with the default signals _and_ SIGUSR1:\nadeiu(() =\u003e {\n  // ...\n}, { signals: [...DEFAULT_SIGNALS, 'SIGUSR1'] })\n```\n\n### Specifying a Timeout\n\nBy default, handlers will have no timeout imposed. If, however, you wish to only wait a specific amount\nof time for a handler to run, the `timeout` option may be used:\n\n```ts\nimport adeiu from '@darkobits/adeiu'\n\n// Register a handler that will have 5 seconds to execute.\nadeiu(() =\u003e {\n  // ...\n}, { timeout: 5000 })\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarkobits%2Fadeiu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarkobits%2Fadeiu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarkobits%2Fadeiu/lists"}