MCPcopy Create free account
hub / github.com/contentlayerdev/contentlayer / readFileBuffer

Function readFileBuffer

packages/@contentlayer/utils/src/node/fs.ts:69–81  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

67 )
68
69const readFileBuffer = (filePath: string): T.Effect<OT.HasTracer, ReadFileError | FileNotFoundError, Buffer> =>
70 OT.withSpan('readFileBuffer', { attributes: { filePath } })(
71 T.tryCatchPromise(
72 () => fs.readFile(filePath),
73 (error: any) => {
74 if (error.code === 'ENOENT') {
75 return new FileNotFoundError({ filePath })
76 } else {
77 return new ReadFileError({ filePath, error })
78 }
79 },
80 ),
81 )
82
83const readFileJson = <T extends JsonValue = JsonValue>(
84 filePath: string,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…