node package manager


Node.js utility; stupidly-simple recursive / non-recursive project file fetcher.


Recursive / non-recursive file collector (any file type). Sends full path of each file to your callback. Belongs to the Encore framework project: |

Finds files having a specified extension, and passes the full path to the file as the argument to the callback that you provide. Also runs recursively if recursive is true. This allows automated loading of project files according to your own rules.

Works really well with easyioc (git) (npm), allowing you to quickly specify exactly how to load your entire node.js project, without any redundant manual require() blocks.

var filefetcher = require('filefetcher')
var results = []
function customModuleInclude (file) { results.push(file) /* or whatever you want */ }
    { path:'./relative-path1', type:'js',    recursive:false,  cb:require             },
    { path:'./relative-path2', type:'js',    recursive:false,  cb:require             },
    { path:'./relative-path3', type:'js',    recursive:true,   cb:customModuleInclude },
    { path:'./views',          type:'html',  recursive:true,   cb:YourViewsModule.add }
$ git clone
$ cd filefetcher
$ npm install expect.js
$ npm install -g mocha
$ mocha