(path: string, data: string | Uint8Array)
| 19 | } |
| 20 | |
| 21 | async writeFile(path: string, data: string | Uint8Array): Promise<void> { |
| 22 | const bytes = typeof data === 'string' ? new TextEncoder().encode(data) : data; |
| 23 | |
| 24 | const normalized = path.startsWith('/') ? path.slice(1) : path; |
| 25 | this.files.set(normalized, bytes); |
| 26 | } |
| 27 | |
| 28 | async readFile(path: string, options?: { encoding?: string }): Promise<Uint8Array | string> { |
| 29 | const normalized = path.startsWith('/') ? path.slice(1) : path; |