(input: WorkspaceReadFileInput)
| 256 | } |
| 257 | |
| 258 | async readFile(input: WorkspaceReadFileInput): Promise<WorkspaceReadFileResult> { |
| 259 | if (isSupportedImagePath(input.path)) { |
| 260 | return await readWorkspaceImage(input.path); |
| 261 | } |
| 262 | const content = await fs.readFile(input.path, 'utf8'); |
| 263 | if (input.offset === undefined && input.limit === undefined) return { content }; |
| 264 | const lines = content.split('\n'); |
| 265 | const start = input.offset ?? 0; |
| 266 | const end = input.limit ? start + input.limit : lines.length; |
| 267 | return { content: lines.slice(start, end).join('\n') }; |
| 268 | } |
| 269 | |
| 270 | async writeFile(input: WorkspaceWriteFileInput): Promise<WorkspaceWriteFileResult> { |
| 271 | await fs.writeFile(input.path, input.content, 'utf8'); |
nothing calls this directly
no test coverage detected