MCPcopy Create free account
hub / github.com/Effect-TS/effect / readFileString

Function readFileString

packages/tools/docgen/test/Configuration.test.ts:50–58  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

48 const context = yield* Effect.context<never>()
49 const docgenJson = Option.getOrElse(Context.getOption(context, DocgenJsonTag), () => ({} as DocgenJson))
50 const readFileString: FileSystem.FileSystem["readFileString"] = (filePath) => {
51 const fileName = path.basename(filePath)
52 if (fileName === "package.json") {
53 return Effect.succeed(JSON.stringify({ name: "name", homepage: "homepage" }))
54 } else if (fileName === "docgen.json") {
55 return Effect.succeed(JSON.stringify(docgenJson))
56 }
57 return Effect.die(`file not found: ${filePath}`)
58 }
59 const exists: FileSystem.FileSystem["exists"] = (filePath) => {
60 const fileName = path.basename(filePath)
61 if (fileName === "invalid-json.txt") {

Callers

nothing calls this directly

Calls 1

succeedMethod · 0.45

Tested by

no test coverage detected