jprichardson / node-jsonfile

Easily read/write JSON files.
MIT License
1.2k stars 321 forks source link

Spaces option not working with writeFile() using promises #118

Closed Ragura closed 5 years ago

Ragura commented 5 years ago

Using the following code, the object is written to the file correctly but without the formatting of the spaces:

async writeSettings(settings) {
    const path = app.getAppPath() + "/settings.json";
    await jsonfile.writeFile(path, settings, { spaces: 2 });
}

Using version 5.0.0.

Ragura commented 5 years ago

Never mind, seems it was something extremely weird on my end. I created a seperate Node project with just this package in it and it worked fine. But it still wouldn't work in mine. So I deleted the node_modules folder and ran yarn again. Now it works. Even though I could see zero differences in the installed jsonfile folder in node_modules (even compared the index.js code with the one on github).

In any case, probably not related to this package directly so I'm closing it. Sorry for the false alarm!