(uri: Uri)
| 35 | } |
| 36 | |
| 37 | async readFile(uri: Uri): Promise<Uint8Array> { |
| 38 | try { |
| 39 | const content = fs.readFileSync(uri.fsPath) |
| 40 | return new Uint8Array(content) |
| 41 | } catch (error) { |
| 42 | // Check if it's a file not found error (ENOENT) |
| 43 | if ((error as NodeJS.ErrnoException).code === "ENOENT") { |
| 44 | throw FileSystemError.FileNotFound(uri) |
| 45 | } |
| 46 | // For other errors, throw a generic FileSystemError |
| 47 | throw new FileSystemError(`Failed to read file: ${uri.fsPath}`) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | async writeFile(uri: Uri, content: Uint8Array): Promise<void> { |
| 52 | try { |
no test coverage detected