* Read settings from the file. On a failure return last known settings and * log a warning.
()
| 15 | * log a warning. |
| 16 | */ |
| 17 | public async read(): Promise<T> { |
| 18 | try { |
| 19 | const raw = (await fs.readFile(this.settingsPath, "utf8")).trim() |
| 20 | return raw ? JSON.parse(raw) : ({} as T) |
| 21 | } catch (error: any) { |
| 22 | if (error.code !== "ENOENT") { |
| 23 | logger.warn(error.message) |
| 24 | } |
| 25 | } |
| 26 | return {} as T |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Write settings combined with current settings. On failure log a warning. |
no outgoing calls
no test coverage detected