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

Function stat

packages/@contentlayer/utils/src/fs-in-memory.ts:40–51  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

38}
39
40export const stat = (filePath: string): T.Effect<unknown, FileNotFoundError | StatError, Stats> => {
41 return T.tryCatch(
42 () => fs.statSync(filePath),
43 (error: any) => {
44 if (error.code === 'ENOENT') {
45 return new FileNotFoundError({ filePath })
46 } else {
47 return new StatError({ filePath, error })
48 }
49 },
50 )
51}
52
53export const readFile = (filePath: string): T.Effect<OT.HasTracer, ReadFileError | FileNotFoundError, string> =>
54 OT.withSpan('readFile', { attributes: { filePath } })(

Callers 2

fileOrDirExistsFunction · 0.70
symlinkExistsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…