path.js
* @author Hermann Mayer <hermann.mayer92@gmail.com>
* Recursivly list all files and/or directories for given start point(s).
* @param {Array|String} startPoints - Startpoint to search, or multiple
* @param {Object} options - Options for listing dirs and/or files
Path.prototype.list = function(startPoints, options)
throw new Error('No startPoint(s) was given');
if (!util.isArray(startPoints)) {
options.directories = ('undefined' === typeof options.directories) ? false : options.directories;
options.files = ('undefined' === typeof options.files) ? true : options.files;
startPoints.forEach(function(start) {
var stat = fs.statSync(start);
var filenames = fs.readdirSync(start);
filenames.forEach(function(name) {
var abspath = path.join(start, name);
var abspathStat = fs.statSync(abspath);
if (abspathStat.isDirectory()) {
rDirs = self.list([abspath], options);
-1 == dirs.indexOf(dir) && dirs.push(dir);
-1 == dirs.indexOf(dir) && dirs.push(rDirs);
if (abspathStat.isFile() && options.files) {