Package Exports
- enumerate-files
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (enumerate-files) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
enumerate-files
List all files in a given directory
const enumerateFiles = require('enumerate-files');
enumerateFiles('./node_modules/enumerate-files/').then(files => {
files;
/* Set {
'/Users/example/node_modules/LICENSE',
'/Users/example/node_modules/README.md',
'/Users/example/node_modules/index.js',
'/Users/example/node_modules/package.json'
} */
const iterator = files.keys();
iterator.next().value; //=> '/Users/example/project/LICENSE'
iterator.next().value; //=> '/Users/example/project/README.md'
iterator.next().value; //=> '/Users/example/project/index.js'
iterator.next().value; //=> '/Users/example/project/package.json'
iterator.next().value; //=> undefined
});
Installation
npm install enumerate-files
API
const enumerateFiles = require('enumerate-files');
enumerateFiles(dir)
dir: String
(directory path)
Return: Promise<Set>
The promise will be fulfilled with a Set
of strings — absolute paths of all files included in a given directory. Symbolic links and directories are excluded.
License
Copyright (c) 2017 Shinnosuke Watanabe
Licensed under the MIT License.