(path: string, content: FileContent, options?: WriteFileOptions)
| 119 | public async writeFile(path: string, content: FileContent, options: WriteFileOptions): Promise<void>; |
| 120 | |
| 121 | public async writeFile(path: string, content: FileContent, options?: WriteFileOptions): Promise<void> { |
| 122 | let encoding = undefined; |
| 123 | let recursive = false; |
| 124 | |
| 125 | if (typeof options === 'object') { |
| 126 | encoding = options.encoding; |
| 127 | recursive = !!options.recursive; |
| 128 | } else if (typeof options === 'string') { |
| 129 | encoding = options; |
| 130 | } |
| 131 | |
| 132 | await this.channel.send('fs/writeFile', { path, content, encoding, recursive }).catch((error) => { |
| 133 | throw new Error(format('Failed to write file at path "%s"', path), { cause: error }); |
| 134 | }); |
| 135 | } |
| 136 | |
| 137 | public async readdir(path: string): Promise<string[]> { |
| 138 | const response = await this.channel.send('fs/readdir', { path }).catch((error) => { |
no test coverage detected