indexzero / nconf

Hierarchical node.js configuration with files, environment variables, command-line arguments, and atomic object merging.
https://github.com/indexzero/nconf
MIT License
3.87k stars 253 forks source link

config json file is empty (all data is wiped out) #411

Open alishefaee opened 1 year ago

alishefaee commented 1 year ago

I used config json file to save my config. but I rarely sometimes encountered an empty file and I didn't know why. Until recently this happend when electricity was gone ( or computer is unplugged ). The config.json file exists but is empty.

"nconf": "^0.12.0"

OS: Window 10

mfpereira commented 3 months ago

Hi alishefaee! I know it was a long time ago, but you discovered how to solve this problem?

It is happening to me too and we are using the lib to critical config files.

alishefaee commented 3 months ago

@mfpereira No, I didn't

tinwinaung commented 1 month ago

This is an old issue and still does not work with example. I think that it is due to memory and format parameters in save function implementation. Just use save without callback function config.save(); will still work.