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

Function writeFileJson

packages/@contentlayer/utils/src/node/fs.ts:113–126  ·  view source on GitHub ↗
({
  filePath,
  content,
}: {
  filePath: string
  content: JsonValue
})

Source from the content-addressed store, hash-verified

111 )
112
113const writeFileJson = ({
114 filePath,
115 content,
116}: {
117 filePath: string
118 content: JsonValue
119}): T.Effect<OT.HasTracer, WriteFileError | JsonStringifyError, void> =>
120 pipe(
121 T.tryCatch(
122 () => JSON.stringify(content, null, 2) + '\n',
123 (error) => new JsonStringifyError({ error }),
124 ),
125 T.chain((contentStr) => writeFile(filePath, contentStr)),
126 )
127
128const mkdirp = <T extends string>(dirPath: T): T.Effect<OT.HasTracer, MkdirError, void> =>
129 OT.withSpan('mkdirp', { attributes: { dirPath } })(

Callers

nothing calls this directly

Calls 1

writeFileFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…