fs8
It's a stable JSON database module that doesn't lose your data due to high traffic and comes with built-in LZMA file compression.
Usage
const fs8 = require("fs8");
-
fs8.save(path, data)
-
path
: anyfs.read
-compatiblepath
value -
data
: anyJSON.stringify
-compatible value - Returns:
undefined
-
-
fs8.load(path)
Good Practice
If you're running on a large database which is very frequently altered, you might not want to save the data every time there is an edit.
Instead, it is recommended that you save on an interval. Here is an example, which saves the data
variable to data.fs8
every minute.
const fs8 = require("fs8");
const data = fs8.load("data.fs8");
setInterval(() => {
fs8.save("data.fs8", data);
}, 60000);
// Then do whatever you want with `data` down here.
This way, if the process ever crashes, you'll lose a minute of data, but you'll also not have to deal with the high processing power of repeatedly stringifying, compressing, and writing.