.save()

Writes the cached data into the JSON file.

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?