{"id":18557383,"url":"https://github.com/prestaul/on-exit","last_synced_at":"2025-05-15T14:09:47.147Z","repository":{"id":31182031,"uuid":"34742532","full_name":"Prestaul/on-exit","owner":"Prestaul","description":"Register tasks to perform when the process exits","archived":false,"fork":false,"pushed_at":"2015-04-28T19:03:02.000Z","size":124,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-15T14:09:30.678Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Prestaul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-28T16:31:50.000Z","updated_at":"2017-10-16T00:28:53.000Z","dependencies_parsed_at":"2022-09-20T23:30:54.940Z","dependency_job_id":null,"html_url":"https://github.com/Prestaul/on-exit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prestaul%2Fon-exit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prestaul%2Fon-exit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prestaul%2Fon-exit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prestaul%2Fon-exit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Prestaul","download_url":"https://codeload.github.com/Prestaul/on-exit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355296,"owners_count":22057354,"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":[],"created_at":"2024-11-06T21:35:26.287Z","updated_at":"2025-05-15T14:09:42.135Z","avatar_url":"https://github.com/Prestaul.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# on-exit\n\nEasily register tasks to perform when the current node process exits.\n\n\n# Install\n\n```bash\nnpm install on-exit\n```\n\n\n## Usage\nCall onExit one or more times to add process cleanup tasks:\n\n```js\nvar onExit = require('on-exit');\n\nonExit(function() {\n\tconsole.log('Closing db connections...');\n\tdb.close();\n});\n\nonExit(function() {\n\tconsole.log('Performing other cleanup...');\n\tapp.cleanup();\n});\n```\n\nWhen the process exits handlers will be run in the order that they were added.\n\n\n## Debug logs\nYou can set a logging function if you would like to log kill signals and exit events:\n\n```js\nvar onExit = require('on-exit').logger(function(msg) {\n    myCustomLogger.log(msg);\n});\n\n// Or to console.log\nonExit.logger(console.log.bind(console));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprestaul%2Fon-exit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprestaul%2Fon-exit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprestaul%2Fon-exit/lists"}