( filePath: string, encoding?: BufferEncoding )
| 153 | * Wrapper around fs.readFile that validates path first |
| 154 | */ |
| 155 | export async function readFile( |
| 156 | filePath: string, |
| 157 | encoding?: BufferEncoding |
| 158 | ): Promise<string | Buffer> { |
| 159 | const validatedPath = validatePath(filePath); |
| 160 | return executeWithRetry<string | Buffer>(() => { |
| 161 | if (encoding) { |
| 162 | return fs.readFile(validatedPath, encoding); |
| 163 | } |
| 164 | return fs.readFile(validatedPath); |
| 165 | }, `readFile(${filePath})`); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Options for writeFile |
nothing calls this directly
no test coverage detected