Socket
Socket
Sign inDemoInstall

filefetcher

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    filefetcher

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


Version published
Weekly downloads
689
increased by18.59%
Maintainers
1
Install size
5.70 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 30 Dec 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc