Doing a cleanup action just before Node.js exits

后端 未结 11 1338
时光说笑
时光说笑 2020-11-22 13:54

I want to tell Node.js to always do something just before it exits, for whatever reason — Ctrl+C, an exception, or any other reason.

I tried th

11条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 14:16

    async-exit-hook seems to be the most up-to-date solution for handling this problem. It's a forked/re-written version of exit-hook that supports async code before exiting.

提交回复
热议问题