0.2.1 • Published 7 years ago

@frctl/readr v0.2.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

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).

Build Status NPM Version

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