Skip to content

Recursively list all files and directories within a target directory.

License

Notifications You must be signed in to change notification settings

allmarkedup/readr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Recursively list all files and directories within a target directory.

Resources

License

Stars

Watchers

Forks

Packages

No packages published