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

Function stat

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

Source from the content-addressed store, hash-verified

40}
41
42const stat = (filePath: string): T.Effect<unknown, FileNotFoundError | StatError, Stats> => {
43 return T.tryCatchPromise(
44 async () => fs.stat(filePath),
45 (error: any) => {
46 if (error.code === 'ENOENT') {
47 return new FileNotFoundError({ filePath })
48 } else {
49 return new StatError({ filePath, error })
50 }
51 },
52 )
53}
54
55const readFile = (filePath: string): T.Effect<OT.HasTracer, ReadFileError | FileNotFoundError, string> =>
56 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…