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