Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

castor-load

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

castor-load

Traverse a directory to build a MongoDB collection with the found files. Then it's enable to keep directory and collection synchronised.

  • 1.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
40
increased by185.71%
Maintainers
2
Weekly downloads
 
Created
Source

FileRake for NodeJS/Javascript

Traverse a directory to build a MongoDB collection with the found files. Then it's enable to keep directory and collection synchronised.

Contributors

  • Nicolas Thouvenin

Installation

With npm do:

$ npm install filerake

Tests

Use mocha to run the tests.

$ npm install mocha
$ mocha test

API Documentation

Constructor Filerake(String directory, [Object options])

Create an new object to synchronise directory with MongoDB collection

###Options

  • mongo.url - string - URL to connect to MongoDB (see documentation, if not specified, it can look up the environment variable "MONGO URL" ; default : 'mongodb://localhost:27017/test/'
  • ignore - array - List of files to ignore (Regex accepted) : default : empty
  • collname - string - MongoDB collection name : *default : automatic *
  • persitent - boolean - Keep synchronization after a complete analysis : *default : true *
  • concurrency - number - Determine how many statement should be run in parallel : *default : 1 *
  • maxFileSize - string - Limits the size of each file in the directory : *default : 128mb *
  • delay - number - Delay file processing when the stack is full (milliseconds) : *default : 30000 *
 var options = {
	 "mongo" : {
		"url" : "mongodb://localhost:27017/test/"
	  },
	"ignore" : [ "**/.*", "*~", "*.sw?", "*.old", "*.bak", "**/node_modules"]
};
var fr = new Filerake(__dirname, options);

use (Function callback)

Use callback to add/remove some information on each file found

var fr = new Filerake(__dirname);
fr.use(function (doc, next) {
    doc.name = doc.basename.toUpperCase();
    next();
  };
}

sync (Function callback)

start synchronization between the directory and the MongoDB collection. callback will be called after a complete analysis. The first parameter will contain the Error object if an error occured, or null otherwise. While the second parameter will contain an handle to the MongoDb collection.

var fr = new Filerake(__dirname);
fr.sync(function(err, collection) {
	console.log('Synchronistion done !');
	}
)

Keywords

FAQs

Package last updated on 03 Nov 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc