Download lib/lowdb/adapters/JSONFileSync.js from RamaZyx/StableBOT: direct link, hf CLI and curl.
- Browser
- Download file 466 Bytes
-
https://huggingface.co/RamaZyx/StableBOT/resolve/main/lib/lowdb/adapters/JSONFileSync.js
- Command line
-
hf download hf://RamaZyx/StableBOT/lib/lowdb/adapters/JSONFileSync.js
-
curl -L -o JSONFileSync.js https://huggingface.co/RamaZyx/StableBOT/resolve/main/lib/lowdb/adapters/JSONFileSync.js
466 Bytes
| const { TextFileSync } = require('./TextFileSync.js'); | |
| class JSONFileSync { | |
| constructor(filename) { | |
| this.adapter = new TextFileSync(filename); | |
| } | |
| read() { | |
| const data = this.adapter.read(); | |
| if (data === null) { | |
| return null; | |
| } | |
| else { | |
| return JSON.parse(data); | |
| } | |
| } | |
| write(obj) { | |
| this.adapter.write(JSON.stringify(obj, null, 2)); | |
| } | |
| } | |
| module.exports = { JSONFileSync }; | |