-
Notifications
You must be signed in to change notification settings - Fork 80
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
Can we have append method ? #131
Comments
Seconding this |
I would appreciate this as well |
I concur. It really bothers me that I have to have 20 JSON files for 20 keys, instead of being able to traverse one file with 20 keys within it. |
where is the problem? append your keys to a existing file:
|
if you want to append to a file having data in array of objects form [ {} ,{} ,{} ]. then for now we can do is
if the file is fresh. write an emtpy array [] to it to avoid any errors. |
@Serjeel-Ranjan-911 Sounds interesting and simple enough. Perhaps you would be interested in sending a PR yourself, or at least an initial draft? |
@jviotti this is not an efficient method. It's a temporary fix for people making it work. This would be bad for very large files. |
@Serjeel-Ranjan-911 I agree, but sadly you can't do anything more with JSON with the parsers available in Node.js. Most JSON parsers require the entire document to be parsed before any modification, and then written back again. If your use case involves appending a lot of data to a list, I'd recommend using something other than JSON. |
Eg. storage.append(keyname,data,callback)
The text was updated successfully, but these errors were encountered: