async-readdir
v1.1.2
Published
Asynchronous and recursive version of fs.readdir() for large numbers of files
Downloads
6
Maintainers
Readme
async-readdir
Asynchronously and recursively list all files in a directory and in its subdirectories.
Why?
I needed a barebones way to recursively get a list of tens of thousands files in a directory and its subdirectory. Many other modules have all sorts of fancy filtering, sorting, and streaming functionality. I didn't need that or any of the overhead that comes with it. async-readdir will just give you a simple array of all files in a directory without blocking or overflowing the event loop.
Dependencies
In the era of crazy npm package dependency graphs, async-readdir only has one external dependency, async. Well, technically two since async also has one dependency, lodash. Eventually I'll get around to using promises or async/await to bring this number down to zero.
Installation
$ npm install async-readdir --save
TypeScript typings are included with the installation by default (@types/async-readdir
isn't currently available).
Usage
var readdir = require("async-readdir");
readdir.read("./data", (error, files) => {
console.log("done: " + files);
});
License
Copyright (c) 2018, John Grube Released under the MIT license.