(path: string, encoding?: FSEncoding)
| 102 | public async readFile(path: string, encoding: BufferEncoding): Promise<string>; |
| 103 | |
| 104 | public async readFile(path: string, encoding?: FSEncoding): Promise<FileContent> { |
| 105 | const response = await this.channel.send('fs/readFile', { path, encoding }).catch((error) => { |
| 106 | throw new Error(format('Failed to read file at path "%s"', path), { cause: error }); |
| 107 | }); |
| 108 | if (!response) { |
| 109 | throw new Error('File not found'); |
| 110 | } |
| 111 | return response.data; |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Write a file at the given path. |
no test coverage detected