.save()

Writes the cached data into the JSON file (database).

This method must be used if you set saveOnUpdate to false when creating the database, otherwise you should not use it.

save()

db.toJSON(); // { counter: 17 }

db.add('counter', 3); // 17

db.get('counter'); // 17

db.save();

db.get('counter'); // 20

Last updated