| 243 | }).catch(t => this.logErr(t)) |
| 244 | } |
| 245 | loaddata() { |
| 246 | if (!this.isNode()) return {}; { |
| 247 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); |
| 248 | const t = this.path.resolve(this.dataFile), |
| 249 | e = this.path.resolve(process.cwd(), this.dataFile), |
| 250 | s = this.fs.existsSync(t), |
| 251 | i = !s && this.fs.existsSync(e); |
| 252 | if (!s && !i) return {}; { |
| 253 | const i = s ? t : e; |
| 254 | try { |
| 255 | return JSON.parse(this.fs.readFileSync(i)) |
| 256 | } catch (t) { |
| 257 | return {} |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | writedata() { |
| 263 | if (this.isNode()) { |
| 264 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); |