File Operations when app exits

Hi there,

our app depends heavily on data stored on the local filesystem. Therefore i have to make sure this data is saved. Currently, whenever there are changes in the data, i save the whole file containing the data instantly to make sure the data has been written to the local filesystem. However, this seems inefficient to me. Is there a way to detect when the app closes and in that case to call a function which is guaranteed to finish some file operations?

In case you are talking about an electron app, you should probably ask this question at their forums.

Hi, I’m talking about a meteor app. Offline functionality is a requirement for our app.