node-jsonfile
node-jsonfile copied to clipboard
does it support append file?
is there a way to do append new objects to a file?
I have the same question. Its working well for me but it overwrites the existing json rather than adding to it
Same here... this would be a perfect little json to file utility if it included jsonfile.appendFile() and jsonfile.appendFileSync() functionality too.
:+1: without this I cant use it.
please support append file
See my comments here, I think it's related.
I had a similar issue, wanted to to hack our package.json file to update the browser key depending on the environment, and this approach worked okay.
TL;DR - read the file in the object, update the update, and write the object back to the file afresh.
As discussed in https://github.com/jprichardson/node-jsonfile/issues/67, you can use Object.assign to accomplish something like this. You can't truly append to a JSON file in the filesystem sense, so I don't see the point of adding this syntax sugar to jsonfile.
@jprichardson what are your thoughts here?
@jprichardson what are your thoughts here?
Agreed. I'd prefer to rework (move to its own section) the README a bit to make it very clear and distinct on the two cases of appending or updating.