@elricb/readdir-recursive
v1.1.0
Published
Read directory contents recursively.
Downloads
5
Readme
@elricb/readdir-recursive
Recursively steps through directory and all sub-directories, returning each item into callback
.
Requirements
- node - recommended lts version >= 12
Install
$ npm install --save @elricb/readdir-recursive
Usage
Warning: This does not have any max-depth or max-file checking. If you need protection from large directories use
Asynchronous
,throw error
inside thecallback
, and processing will halt.
Asynchronous
import {readdirRecursive} from "@elricb/readdir-recursive";
readdirRecursive(__dirname, function(directory, dirent) {
if (dirent.isFile()) {
console.log(directory);
}
})
.then(function() {
console.log("Done.");
})
.catch(function(error) {
console.error(error);
});
Synchronous
import {readdirRecursiveSync} from "@elricb/readdir-recursive";
readdirRecursiveSync(__dirname, function(directory, dirent) {
if (dirent.isDirectory()) {
console.log(directory);
}
});
console.log("Done.");
Documentation
Release Notes
View commit tag for release notes.
API
See ./docs/index.html
.