readdirr

Recursive fs.readdir

Usage no npm install needed!

<script type="module">
  import readdirr from 'https://cdn.skypack.dev/readdirr';
</script>

README

readdirr

Recursive fs.readdir.

readdirr(root, filterFn)

  • root: string - The root directory to scan.

  • filterFn: string -> boolean - File name filtering function. By default it skips dot files and node_modules.

  • returns Promise<[string]> - File paths relative to root

If root is already a file then a single empty string will be returned

Example

const readdirr = require('readdirr')
readdirr('node_modules/some-module').then(files => {
  for (const file of files) console.log(file)
})
// package.json
// README.md
// lib/index.js

TODO

  • Sync version
  • Tests