Comments (6)
you don't need to call .load()
for loading data, you should just do store.set(object)
or store.set(key, val)
. That will automatically update the persisted data and in-memory data. If that still doesn't work let us know.
edit: doh! I just realized that I hadn't published version 3.0! I was obviously confused, and I'm sure I confused you guys as well. Apologies!
@plopez01 try again with 3.0 and let me know if you have any issues. thanks!
from data-store.
Make sure you have the latest version of data-store, and use the API (call .load()
) to get the store instead of node's fs methdods. Otherwise you might be trying to load the store before a write has been performed.
Also note that there have been some changes to internals in 2.0. It sounds like you were using private properties, there is no longer a .cache
property in 2.0.
edit: @doowb changed to 2.0 (this is published to npm but currently still in the dev
branch)
from data-store.
Thanks, im going to update data-store and see if works. Im using gists to download a json and set that download json to the .json file of data-store, my problem was that when i update the json, the "data" doesn't get updated until i restart my app. Let's see if updating helps.
from data-store.
I am calling store.load()
and it's not working. Let me show my code.
gists.download({id: 'ID of gist'}, function(err, res) {
let finalconte = JSON.parse(conte);
baseDatos = finalconte.files['abc.json'].content
store.load(baseDatos);
});
This code is not loading the content of the gist to the store, and I don't know why.
from data-store.
@plopez01 store.load()
re-loads the json file into memory. It doesn't take any arguments.
If you do the following, then it will re-load the store, then update it with the new values:
store.load();
store.set(baseDatos);
If you want to completely overwrite the file with the new data, then you can do this:
// this will overwrite the entire object, then save it to the file.
store.data = baseDatos;
from data-store.
Well thanks a lot!
from data-store.
Related Issues (20)
- TypeError: Class constructor Store cannot be invoked without 'new' HOT 2
- store.set() key with dot dymbol HOT 1
- Inconsistency of undefined HOT 1
- Delete object inside array HOT 1
- error while using del method in typescript HOT 1
- Does store.load() delete the data?
- store.clear into store.set into store.load deletes whole store HOT 2
- Create optional lock file for use of the data-store by external process HOT 7
- Release Notes ? HOT 1
- Retrieving data-store HOT 1
- deprecated isObject HOT 1
- decreated isObject HOT 1
- NPM owner HOT 3
- v4.1.0 has not been published to npm HOT 6
- How can stored values be updated? HOT 1
- Does not seem to save new data, but reverts back to old data. HOT 6
- Data-store wont save anything. HOT 2
- How to pass a variable as key
- Depends on 2 high severity vulnerabilities
- Data store not reading correctly the file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from data-store.