@frctl/readr
v0.2.1
Published
Recursively list all files and directories within a target directory.
Downloads
7
Keywords
Readme
readr
Recursively list all files and directories within a target directory.
Similar to recursive-readdir but it includes paths of subdirectories in the files list (and it returns a Promise instead of using a callback).
Install
Installation using Yarn is recommended.
yarn add @frctl/readr
Usage
readr
returns a Promise
that is resolved with an array of file/directory paths.
const readr = require('@frctl/readr');
readr('path/to/files').then(files => {
// do something with the files list.
});
You can also provide a filter function to ignore certain files:
const readr = require('@frctl/readr');
const filter = (path, stat) => stat.isFile(); // filter out directories
readr('path/to/files', filter).then(files => {
console.log(files); // no directories here!
});
Requirements
@frctl/readr
requires Node >= v6.0