(path: string)
| 151 | } |
| 152 | |
| 153 | async getJSON<T>(path: string): Promise<T | null> { |
| 154 | try { |
| 155 | const data = await this.get(path); |
| 156 | return JSON.parse(new TextDecoder().decode(data)) as T; |
| 157 | } catch { return null; } |
| 158 | } |
| 159 | |
| 160 | async putJSON<T>(path: string, data: T): Promise<void> { |
| 161 | await this.put(path, new TextEncoder().encode(JSON.stringify(data))); |