const fs = require('fs') const STORAGE_FILE = 'storage.json' let storage = { init: function() { if (!fs.existsSync(STORAGE_FILE)) { fs.writeFileSync(STORAGE_FILE, '{}') } let raw = fs.readFileSync(STORAGE_FILE) this.data = JSON.parse(raw) }, save: function() { fs.writeFileSync(STORAGE_FILE, JSON.stringify(this.data)) } } module.exports = storage;