(name: string, path: string)
| 273 | } |
| 274 | |
| 275 | async fsList(name: string, path: string): Promise<Array<SpriteFsEntry>> { |
| 276 | const url = this.spritePath( |
| 277 | name, |
| 278 | `/fs/list?path=${encodeURIComponent(path)}`, |
| 279 | ) |
| 280 | const response = await fetch(url, { |
| 281 | method: 'GET', |
| 282 | headers: this.headers(), |
| 283 | }) |
| 284 | if (!response.ok) await this.fail('GET', url, response) |
| 285 | const body = (await response.json()) as { |
| 286 | entries?: Array<{ name?: unknown; path?: unknown; isDir?: unknown }> |
| 287 | } |
| 288 | return (body.entries ?? []).map((entry) => ({ |
| 289 | name: String(entry.name ?? ''), |
| 290 | path: String(entry.path ?? ''), |
| 291 | type: entry.isDir === true ? ('dir' as const) : ('file' as const), |
| 292 | })) |
| 293 | } |
| 294 | |
| 295 | async listCheckpoints( |
| 296 | name: string, |
no test coverage detected