(filePath: string)
| 51 | } |
| 52 | |
| 53 | export const readFile = (filePath: string): T.Effect<OT.HasTracer, ReadFileError | FileNotFoundError, string> => |
| 54 | OT.withSpan('readFile', { attributes: { filePath } })( |
| 55 | T.tryCatch( |
| 56 | () => fs.readFileSync(filePath, 'utf8') as string, |
| 57 | (error: any) => { |
| 58 | if (error.code === 'ENOENT') { |
| 59 | return new FileNotFoundError({ filePath }) |
| 60 | } else { |
| 61 | return new ReadFileError({ filePath, error }) |
| 62 | } |
| 63 | }, |
| 64 | ), |
| 65 | ) |
| 66 | |
| 67 | export const readFileBuffer = (filePath: string): T.Effect<OT.HasTracer, ReadFileError | FileNotFoundError, Buffer> => |
| 68 | OT.withSpan('readFileBuffer', { attributes: { filePath } })( |
no outgoing calls
no test coverage detected
searching dependent graphs…