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

Function readFile

packages/platform/node-shared/src/NodeFileSystem.ts:428–441  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

426// == readFile
427
428const readFile = (path: string) =>
429 Effect.callback<Uint8Array, Error.PlatformError>((resume, signal) => {
430 try {
431 NFS.readFile(path, { signal }, (err, data) => {
432 if (err) {
433 resume(Effect.fail(handleErrnoException("FileSystem", "readFile")(err, [path])))
434 } else {
435 resume(Effect.succeed(data))
436 }
437 })
438 } catch (err) {
439 resume(Effect.fail(handleBadArgument("readFile")(err)))
440 }
441 })
442
443// == readLink
444

Callers

nothing calls this directly

Calls 5

handleErrnoExceptionFunction · 0.90
handleBadArgumentFunction · 0.85
resumeFunction · 0.50
failMethod · 0.45
succeedMethod · 0.45

Tested by

no test coverage detected