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

Function readDirectory

packages/platform/deno/src/DenoFileSystem.ts:355–366  ·  view source on GitHub ↗
(path, options)

Source from the content-addressed store, hash-verified

353 )
354
355const readDirectory: FileSystem.FileSystem["readDirectory"] = (path, options) => {
356 if (options?.recursive) {
357 return Effect.map(
358 collectAsyncIterable("readDirectory", path, () => walk(path)),
359 (entries) => entries.map((entry) => relative(path, entry.path)).filter(Boolean)
360 )
361 }
362 return Effect.map(
363 collectAsyncIterable("readDirectory", path, () => Deno.readDir(path)),
364 (entries) => entries.map((entry) => entry.name)
365 )
366}
367
368const readFile: FileSystem.FileSystem["readFile"] = (path) =>
369 tryPromise("readFile", path, (signal) => Deno.readFile(path, { signal }))

Callers

nothing calls this directly

Calls 5

collectAsyncIterableFunction · 0.85
relativeFunction · 0.85
filterMethod · 0.80
walkFunction · 0.50
mapMethod · 0.45

Tested by

no test coverage detected