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

Function readFile

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

Source from the content-addressed store, hash-verified

542// == readFile
543
544const readFile = (path: string) =>
545 Effect.callback<Uint8Array, Error.PlatformError>((resume, signal) => {
546 try {
547 NFS.readFile(path, { signal }, (err, data) => {
548 if (err) {
549 resume(Effect.fail(handleErrnoException("FileSystem", "readFile")(err, [path])))
550 } else {
551 resume(Effect.succeed(data))
552 }
553 })
554 } catch (err) {
555 resume(Effect.fail(handleBadArgument("readFile")(err)))
556 }
557 })
558
559// == readLink
560

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected