(file: fs.PathLike | number, encoding?: string)
| 306 | public async requestFileContent(file: fs.PathLike | number): Promise<Buffer>; |
| 307 | public async requestFileContent(file: fs.PathLike | number, encoding: string): Promise<string>; |
| 308 | public async requestFileContent(file: fs.PathLike | number, encoding?: string): Promise<string | Buffer | undefined> { |
| 309 | if (this._isStarted) { |
| 310 | if (encoding !== undefined) { |
| 311 | const content: string | unknown = await liveShareRequest(Callback.GetFileContent, file, encoding); |
| 312 | if (typeof content === 'string') { |
| 313 | return content; |
| 314 | } else { |
| 315 | console.error('[GuestService] failed to retrieve file content (not of type "string")'); |
| 316 | } |
| 317 | } else { |
| 318 | const content: Buffer | unknown = await liveShareRequest(Callback.GetFileContent, file); |
| 319 | if (content) { |
| 320 | return content as Buffer; |
| 321 | } else { |
| 322 | console.error('[GuestService] failed to retrieve file content (not of type "Buffer")'); |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | public async requestHelpContent(file: string): Promise<HelpFile | undefined> { |
| 329 | const content: string | null | unknown = await liveShareRequest(Callback.GetHelpFileContent, file); |
no test coverage detected