.save()
Writes the cached data into the JSON file.
This method must be used if you set autoSave
to false
when creating the database, otherwise you should not use it.
save()
db.toJSON(); // { counter: 17 }
db.add('counter', 3); // 20
db.get('counter'); // 20 (cached only)
db.fetch('counter'); // 17
db.save();
db.get('counter'); // 20 (cached and written in the JSON file)
db.fetch('counter'); // 20
Last updated
Was this helpful?