require everything in a directory and bind them to a object
Node.js module for require everything in a directory and bind them to a object synchronously. If a file is tried to load with a missing dependency inside the file will load at a second attemp after loading the other files. There are maximum 5 attemps.
Any of the below
// Return an object hash.requireDirectory = ;// Load all files in a directory.myFiles = null;requireDirectory;// Load all files in a directory and react of return value.myFiles = null;if requireDirectory === trueconsole;// Load all files in a directory and call callback on finish.myFiles = null;requireDirectory;
npm install reqdir
require('reqdir').load(object, directory, [callback]])