How to get a NR "shutdown"

Hi, for several purposes, for example save into a file the actual situation, to load back after deploy or reboot of system I would like to catch from NR the message "shutdown the module", I know it give to modules, for example my LCD when I deploy a change says me always "shutting down", so it catches it.
WHen I experienced some errors in some modules I saw NR reporting a timeout on that module, it takes about 15 seconds, so it means NR is waiting for modules to shut themself down, and this is good because I can have the time to write the files.
Shortly: I need a module who output me "NR is shutting down" and wait from me "I'm ok, I did all" as answer
Thank you for help

Are you writing a custom node? Because if so, you can use the close function which is called not only when Node-RED shuts down but whenever the modules are being unloaded (so for example when you redeploy an instance of your node).

Thanks for reply, no I'm looking for an existing module that can output that and expect to receive the confirmation before tell NR that it unloaded successfully.
NR>unload command>module>output to my flow
My flow>module>yes I'm unloaded>NR

OK, but you should find that if you are using a node to output to a file, it will be using Node.js capabilities to do that - either a synchronous or async file write - either of which would complete before a normal exit of Node.js (even doing ctrl-c on the start process).

So you shouldn't actually need to worry about it.

The only time this wouldn't be true is if the process were "killed" which wouldn't let Node.js shutdown correctly.