{"_id":"exit-hook","_rev":"3151064","name":"exit-hook","description":"Run some code when the process exits","dist-tags":{"latest":"4.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2023-11-28T01:53:56.000Z","created":"2014-08-31T11:19:13.581Z","4.0.0":"2023-08-31T11:16:39.713Z","3.2.0":"2023-01-20T10:30:50.995Z","3.1.4":"2022-12-09T01:40:36.953Z","3.1.3":"2022-12-08T11:49:55.794Z","3.1.2":"2022-10-22T09:14:38.277Z","3.1.1":"2022-10-16T09:05:11.934Z","3.1.0":"2022-08-23T08:53:18.550Z","3.0.0":"2021-08-27T19:14:07.783Z","2.2.1":"2021-02-27T13:01:25.684Z","2.2.0":"2019-04-16T17:19:57.671Z","2.1.0":"2019-04-09T08:29:07.717Z","2.0.0":"2018-03-24T16:04:42.431Z","1.1.1":"2014-09-01T13:14:50.788Z","1.1.0":"2014-08-31T23:31:07.279Z","1.0.0":"2014-08-31T11:19:13.581Z"},"users":{"dylanf":true,"j3kz":true,"heartnett":true},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"versions":{"4.0.0":{"name":"exit-hook","version":"4.0.0","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsd"},"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event","signal","async","asynchronous"],"devDependencies":{"ava":"^5.3.1","execa":"^8.0.1","tsd":"^0.28.1","xo":"^0.56.0"},"types":"./index.d.ts","gitHead":"a32478a214250c51f965447574712a854992531c","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook#readme","_id":"exit-hook@4.0.0","_nodeVersion":"18.16.1","_npmVersion":"9.2.0","dist":{"shasum":"c1e16ebd03d3166f837b1502dac755bb5c460d58","size":4010,"noattachment":false,"key":"/exit-hook/-/exit-hook-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-4.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exit-hook_4.0.0_1693480599511_0.6804083580436007"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-08-31T11:16:39.713Z","publish_time":1693480599713,"_source_registry_name":"default","_cnpm_publish_time":1693480599713},"3.2.0":{"name":"exit-hook","version":"3.2.0","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event","signal","async","asynchronous"],"devDependencies":{"ava":"^3.15.0","execa":"^5.1.1","tsd":"^0.17.0","xo":"^0.44.0"},"types":"./index.d.ts","gitHead":"34078d9abbc3ae74a7a5a30fb1009e974e71c46f","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook#readme","_id":"exit-hook@3.2.0","_nodeVersion":"14.21.1","_npmVersion":"9.2.0","dist":{"shasum":"7d86bc361a4d79278001b72a0509318a6f468f20","size":3996,"noattachment":false,"key":"/exit-hook/-/exit-hook-3.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-3.2.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exit-hook_3.2.0_1674210650791_0.7093863836991616"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-01-20T10:30:50.995Z","publish_time":1674210650995,"_cnpm_publish_time":1674210650995},"3.1.4":{"name":"exit-hook","version":"3.1.4","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event","signal","async","asynchronous"],"devDependencies":{"ava":"^3.15.0","execa":"^5.1.1","tsd":"^0.17.0","xo":"^0.44.0"},"types":"./index.d.ts","gitHead":"c3bdec9cbe2117eaac820b4b721649878537af06","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook#readme","_id":"exit-hook@3.1.4","_nodeVersion":"12.22.1","_npmVersion":"8.19.2","dist":{"shasum":"0207c03701fb18278096ca72346596e5b1608008","size":3922,"noattachment":false,"key":"/exit-hook/-/exit-hook-3.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-3.1.4.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exit-hook_3.1.4_1670550036754_0.3904549296400299"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-12-09T01:43:40.634Z","publish_time":1670550036953,"_cnpm_publish_time":1670550036953},"3.1.3":{"name":"exit-hook","version":"3.1.3","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event","signal","async","asynchronous"],"devDependencies":{"ava":"^3.15.0","execa":"^5.1.1","tsd":"^0.17.0","xo":"^0.44.0"},"types":"./index.d.ts","gitHead":"1779ccf53cab626b878769bd0ee7e048d19debfc","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook#readme","_id":"exit-hook@3.1.3","_nodeVersion":"12.22.1","_npmVersion":"8.19.2","dist":{"shasum":"38054c9f3976afca5a10d50639223abb0ef9f4bf","size":3925,"noattachment":false,"key":"/exit-hook/-/exit-hook-3.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-3.1.3.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exit-hook_3.1.3_1670500195637_0.5092634482636627"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-12-08T12:35:31.959Z","publish_time":1670500195794,"_cnpm_publish_time":1670500195794},"3.1.2":{"name":"exit-hook","version":"3.1.2","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event","signal","async","asynchronous"],"devDependencies":{"ava":"^3.15.0","execa":"^5.1.1","tsd":"^0.17.0","xo":"^0.44.0"},"types":"./index.d.ts","gitHead":"f58f6206d059aa7dc84cefb5a01fda569fb758d8","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook#readme","_id":"exit-hook@3.1.2","_nodeVersion":"14.19.3","_npmVersion":"8.3.2","dist":{"shasum":"a0350684dd81da005d964d7998f01b57432db01d","size":3919,"noattachment":false,"key":"/exit-hook/-/exit-hook-3.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-3.1.2.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exit-hook_3.1.2_1666430078113_0.3485460903433064"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-22T15:12:31.218Z","publish_time":1666430078277,"_cnpm_publish_time":1666430078277},"3.1.1":{"name":"exit-hook","version":"3.1.1","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event","signal","async","asynchronous"],"devDependencies":{"ava":"^3.15.0","execa":"^5.1.1","tsd":"^0.17.0","xo":"^0.44.0"},"types":"./index.d.ts","gitHead":"a0f032e62b0e45e9487ff7e8cadedfa7217079d6","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook#readme","_id":"exit-hook@3.1.1","_nodeVersion":"16.16.0","_npmVersion":"8.3.2","dist":{"shasum":"52ee17128dd4aaec521de740737df3df16ae4582","size":3917,"noattachment":false,"key":"/exit-hook/-/exit-hook-3.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-3.1.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exit-hook_3.1.1_1665911111748_0.9448220661023636"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-16T09:27:14.457Z","publish_time":1665911111934,"_cnpm_publish_time":1665911111934},"3.1.0":{"name":"exit-hook","version":"3.1.0","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event","signal","async","asynchronous"],"devDependencies":{"ava":"^3.15.0","execa":"^5.1.1","tsd":"^0.17.0","xo":"^0.44.0"},"types":"./index.d.ts","gitHead":"b144ddad8bbfcee3cc15312a2db1cc959d50de45","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook#readme","_id":"exit-hook@3.1.0","_nodeVersion":"16.15.0","_npmVersion":"8.3.2","dist":{"shasum":"0ba691facf29637930ead13e727cdc61860331b9","size":3912,"noattachment":false,"key":"/exit-hook/-/exit-hook-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-3.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exit-hook_3.1.0_1661244798391_0.19569461871565474"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-08-23T09:09:58.238Z","publish_time":1661244798550,"_cnpm_publish_time":1661244798550},"3.0.0":{"name":"exit-hook","version":"3.0.0","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event","signal"],"devDependencies":{"ava":"^3.15.0","execa":"^5.1.1","tsd":"^0.17.0","xo":"^0.44.0"},"gitHead":"234efba554f28c4c5665ecee752b65bd669a46b2","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook#readme","_id":"exit-hook@3.0.0","_nodeVersion":"14.17.5","_npmVersion":"7.20.3","dist":{"shasum":"367d132735a24b96569327806cfbf0eb081af7b5","size":2380,"noattachment":false,"key":"/exit-hook/-/exit-hook-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-3.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exit-hook_3.0.0_1630091647639_0.8106118443234953"},"_hasShrinkwrap":false,"publish_time":1630091647783,"_cnpm_publish_time":1630091647783},"2.2.1":{"name":"exit-hook","version":"2.2.1","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava && tsd"},"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event","signal"],"devDependencies":{"ava":"^1.4.1","execa":"^1.0.0","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"06b9fa48ef2c8245b42c558136d75e52ef833022","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook#readme","_id":"exit-hook@2.2.1","_nodeVersion":"12.20.1","_npmVersion":"6.14.10","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"007b2d92c6428eda2b76e7016a34351586934593","size":2350,"noattachment":false,"key":"/exit-hook/-/exit-hook-2.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-2.2.1.tgz"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exit-hook_2.2.1_1614430885530_0.035266720586841105"},"_hasShrinkwrap":false,"publish_time":1614430885684,"_cnpm_publish_time":1614430885684},"2.2.0":{"name":"exit-hook","version":"2.2.0","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava && tsd"},"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event","signal"],"devDependencies":{"ava":"^1.4.1","execa":"^1.0.0","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"f07fd96864d7c8c013ae8fb361ecb82d77a122f5","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook#readme","_id":"exit-hook@2.2.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"f5502f92179018e867f2d8ee4428392da7f3894e","size":2187,"noattachment":false,"key":"/exit-hook/-/exit-hook-2.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-2.2.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exit-hook_2.2.0_1555435197535_0.6053662791757497"},"_hasShrinkwrap":false,"publish_time":1555435197671,"_cnpm_publish_time":1555435197671},"2.1.0":{"name":"exit-hook","version":"2.1.0","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava"},"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event","signal"],"devDependencies":{"ava":"*","execa":"^0.10.0","xo":"*"},"gitHead":"79c3bcecff582833d77cf5a81696a8299abb3ab5","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook#readme","_id":"exit-hook@2.1.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"2be08d8d01220050878577bfa017e104a6c3bcf3","size":1980,"noattachment":false,"key":"/exit-hook/-/exit-hook-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-2.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exit-hook_2.1.0_1554798547565_0.05841812565502913"},"_hasShrinkwrap":false,"publish_time":1554798547717,"_cnpm_publish_time":1554798547717},"2.0.0":{"name":"exit-hook","version":"2.0.0","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/exit-hook.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event","signal"],"devDependencies":{"ava":"*","execa":"^0.10.0","xo":"*"},"gitHead":"352e462d37878371ce7a54381b37a6be2369dfed","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook#readme","_id":"exit-hook@2.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.10.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"b89f6f69b7d080efc2807c66a85957722637db92","size":1949,"noattachment":false,"key":"/exit-hook/-/exit-hook-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/exit-hook_2.0.0_1521907482159_0.595395127353517"},"_hasShrinkwrap":false,"publish_time":1521907482431,"_cnpm_publish_time":1521907482431},"1.1.1":{"name":"exit-hook","version":"1.1.1","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git://github.com/sindresorhus/exit-hook"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"node test.js"},"files":["index.js"],"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event"],"devDependencies":{"ava":"0.0.4"},"bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook","_id":"exit-hook@1.1.1","_shasum":"f05ca233b48c05d54fff07765df8507e95c02ff8","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"f05ca233b48c05d54fff07765df8507e95c02ff8","size":1006,"noattachment":false,"key":"/exit-hook/-/exit-hook-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-1.1.1.tgz"},"directories":{},"publish_time":1409577290788,"_cnpm_publish_time":1409577290788,"_hasShrinkwrap":false},"1.1.0":{"name":"exit-hook","version":"1.1.0","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git://github.com/sindresorhus/exit-hook"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"node test.js"},"files":["index.js"],"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event"],"devDependencies":{"ava":"0.0.4"},"bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook","_id":"exit-hook@1.1.0","_shasum":"06f5ef551030ed7c0e3bc5148ee64c9f5626df87","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"06f5ef551030ed7c0e3bc5148ee64c9f5626df87","size":956,"noattachment":false,"key":"/exit-hook/-/exit-hook-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-1.1.0.tgz"},"directories":{},"publish_time":1409527867279,"_cnpm_publish_time":1409527867279,"_hasShrinkwrap":false},"1.0.0":{"name":"exit-hook","version":"1.0.0","description":"Run some code when the process exits","license":"MIT","repository":{"type":"git","url":"git://github.com/sindresorhus/exit-hook"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"node test.js"},"files":["index.js"],"keywords":["exit","quit","process","hook","graceful","handler","shutdown","sigterm","sigint","terminate","kill","stop","event"],"devDependencies":{"ava":"0.0.4"},"bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"homepage":"https://github.com/sindresorhus/exit-hook","_id":"exit-hook@1.0.0","_shasum":"84e17510af2f170df709c84bb70ba315b00c9019","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"84e17510af2f170df709c84bb70ba315b00c9019","size":882,"noattachment":false,"key":"/exit-hook/-/exit-hook-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/exit-hook/download/exit-hook-1.0.0.tgz"},"directories":{},"publish_time":1409483953581,"_cnpm_publish_time":1409483953581,"_hasShrinkwrap":false}},"readme":"# exit-hook\n\n> Run some code when the process exits\n\nThe `process.on('exit')` event doesn't catch all the ways a process can exit.\n\nThis package is useful for cleaning up before exiting.\n\n## Install\n\n```sh\nnpm install exit-hook\n```\n\n## Usage\n\n```js\nimport exitHook from 'exit-hook';\n\nexitHook(signal => {\n\tconsole.log(`Exiting with signal: ${signal}`);\n});\n\n// You can add multiple hooks, even across files\nexitHook(() => {\n\tconsole.log('Exiting 2');\n});\n\nthrow new Error('????');\n\n//=> 'Exiting'\n//=> 'Exiting 2'\n```\n\nRemoving an exit hook:\n\n```js\nimport exitHook from 'exit-hook';\n\nconst unsubscribe = exitHook(() => {});\n\nunsubscribe();\n```\n\n## API\n\n### exitHook(onExit)\n\nRegister a function to run during `process.exit`.\n\nReturns a function that removes the hook when called.\n\n#### onExit\n\nType: `(signal: number) => void`\n\nThe callback function to execute when the process exits.\n\n### asyncExitHook(onExit, options)\n\nRegister a function to run during `gracefulExit`.\n\nReturns a function that removes the hook when called.\n\nPlease see [Async Notes](#asynchronous-exit-notes) for considerations when using the asynchronous API.\n\n#### onExit\n\nType: `(signal: number) => (void | Promise<void>)`\n\nThe callback function to execute when the process exits via `gracefulExit`, and will be wrapped in `Promise.resolve`.\n\n#### options\n\nType: `object`\n\n##### wait\n\nType: `number`\n\nThe amount of time in milliseconds that the `onExit` function is expected to take. When multiple async handlers are registered, the longest `wait` time will be used.\n\n```js\nimport {asyncExitHook} from 'exit-hook';\n\nasyncExitHook(async () => {\n\tconsole.log('Exiting');\n}, {\n\twait: 300\n});\n\nthrow new Error('????');\n\n//=> 'Exiting'\n```\n\nRemoving an asynchronous exit hook:\n\n```js\nimport {asyncExitHook} from 'exit-hook';\n\nconst unsubscribe = asyncExitHook(async () => {\n\tconsole.log('Exiting');\n}, {\n\twait: 300\n});\n\nunsubscribe();\n```\n\n### gracefulExit(signal?: number): void\n\nExit the process and make a best-effort to complete all asynchronous hooks.\n\nIf you are using `asyncExitHook`, consider using `gracefulExit()` instead of `process.exit()` to ensure all asynchronous tasks are given an opportunity to run.\n\n```js\nimport {gracefulExit} from 'exit-hook';\n\ngracefulExit();\n```\n\n#### signal\n\nType: `number`\n\nThe exit code to use. Same as the argument to `process.exit()`.\n\nIf not specified, the process will exit with `process.exitCode` if set, otherwise `0`.\n\n## FAQ\n\n### Why don't my exit hooks run when using nodemon?\n\nBy default, nodemon uses `SIGUSR2` to restart your app. Since `SIGUSR2` is a user-defined signal, exit-hook does not handle it to avoid conflicts with your app logic.\n\nSolution: Configure nodemon to use standard termination signals:\n\n```sh\nnodemon --signal SIGTERM your-app.js\n```\n\nOr in your `nodemon.json`:\n\n```json\n{\n\t\"signal\": \"SIGTERM\"\n}\n```\n\nAlternatively, you can handle `SIGUSR2` in your app if you specifically need nodemon's default behavior:\n\n```js\n// Handle nodemon restart signal\nprocess.on('SIGUSR2', () => {\n\tgracefulExit();\n});\n```\n\n## Asynchronous Exit Notes\n\n**tl;dr** If you have 100% control over how your process terminates, then you can swap `exitHook` and `process.exit` for `asyncExitHook` and `gracefulExit` respectively. Otherwise, keep reading to understand important tradeoffs if you're using `asyncExitHook`.\n\nNode.js does not offer an asynchronous shutdown API by default [#1](https://github.com/nodejs/node/discussions/29480#discussioncomment-99213) [#2](https://github.com/nodejs/node/discussions/29480#discussioncomment-99217), so `asyncExitHook` and `gracefulExit` will make a \"best effort\" attempt to shut down the process and run your asynchronous tasks.\n\nIf you have asynchronous hooks registered and your Node.js process is terminated in a synchronous manner, a `SYNCHRONOUS TERMINATION NOTICE` error will be logged to the console. To avoid this, ensure you're only exiting via `gracefulExit` or that an upstream process manager is sending a `SIGINT` or `SIGTERM` signal to Node.js.\n\nAsynchronous hooks should make a \"best effort\" to perform their tasks within the `wait` time, but also be written to assume they may not complete their tasks before termination.\n","_attachments":{},"homepage":"https://github.com/sindresorhus/exit-hook#readme","bugs":{"url":"https://github.com/sindresorhus/exit-hook/issues"},"license":"MIT"}