Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/dtils/fs.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/fs.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>>