I'm trying to make a system in which when I close my node.js program, it'll save the last id checked in the program to a text file
require('shutdown-handler').on('exit', function(e) {
e.preventDefault();
fs.writeFileSync('LastID.txt', "Change something in the text file");
});
Right now the text inside the text file is "TEST" and in the code you see above I'm trying to change it to "Change something in the text file" when ever I close the node.js program. For some reason I can't get it to change. I'm pretty bad at javascript and I'm not sure how to fix or even make this work. Any help or tips would be lovely.