Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does it support append file? #52

Open
sahas- opened this issue Jun 13, 2016 · 7 comments
Open

does it support append file? #52

sahas- opened this issue Jun 13, 2016 · 7 comments

Comments

@sahas-
Copy link

sahas- commented Jun 13, 2016

is there a way to do append new objects to a file?

@ajsingh007
Copy link

I have the same question. Its working well for me but it overwrites the existing json rather than adding to it

@dudleyjosh
Copy link

dudleyjosh commented Jun 27, 2016

Same here... this would be a perfect little json to file utility if it included jsonfile.appendFile() and jsonfile.appendFileSync() functionality too.

@SCBuergel
Copy link

👍 without this I cant use it.

@kamikazechaser
Copy link

please support append file

@andela-anandaa
Copy link

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.

@RyanZim
Copy link
Collaborator

RyanZim commented Apr 25, 2017

As discussed in #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
Copy link
Owner

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants