Skip to content

rm-rf-etc/filefetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Filefetcher.js

Recursive / non-recursive file collector (any file type). Sends full path of each file to your callback. Belongs to the Encore framework project: encore.jit.su | github.com/rm-rf-etc/encore

NPM

Description

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.

Usage

var filefetcher = require('filefetcher')

var results = []
function customModuleInclude (file) { results.push(file) /* or whatever you want */ }

filefetcher([
    { 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 }
])

How To Run The Tests

$ git clone http://github.com/rm-rf-etc/filefetcher.git
$ cd filefetcher
$ npm install expect.js
$ npm install -g mocha
$ mocha

About

A node.js utility for automatically loading project files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published