Skip to main content
Module

x/dtils/mod.unstable.ts>recursiveReadFiles

The best unofficial library of utilities for Deno applications
Go to Latest
function recursiveReadFiles
import { recursiveReadFiles } from "https://deno.land/x/dtils@2.4.0/mod.unstable.ts";

Read the contents of directory into the returned map. Symlinks are ignored.

Example

Assume an FS structure like so...

/root
  |- foo
    |- bin
  |- bar
    |- baz

...when running with the text reader...

console.log(await recursiveReadFiles('/root', readText))

... the output should match this:

Map(2) {
  "foo/bin" => "...",
  "bar/baz" => "..."
}

Parameters

directory: string
reader: (path: string) => Promise<T>

Returns

Promise<Map<string, T>>