Require files from a directory tree recursively
npm install require-pathrequire(...) files from a directory tree in Node.jsWorks with Node.js v4.0.0 and above.
| Branch | Status |
| ------------- |:-------------:|
| Master |  |
| All |  |
``js
var path = require('path');
requirePath({
path: path.join(__dirname, 'my-directory'),
include: ['/.js', '/.json'],
exclude: ['*/Spec.js']
})
// returns a standard promise
.then(function (modules) {
// modules is a map of filenames to require()'d components from those files`
})
// don't forget to handle errors!
.catch(handleError);
| Property | Description |
| -------- | ----------- |
| path | _string_ or _array_ of absolute paths to search for files. Default: .. |require(...)
| include | _string_ or _array_ of minimatch patterns. A file in the path(s) that match at least one pattern will be 'd unless the file also matches an exclusion pattern. Default: ['/.js', '/.json'].|['*/Spec.js']`. |
| exclude | _string_ or _array_ of minimatch patterns. Files in the path(s) that match at least one pattern will be excluded. Default: