Skip to content

matthewwilson/camel.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

camel.js

Join the chat at https://gitter.im/matthewcodes/camel.js npm version Build Status

NPM

###Installation

Install using npm:

npm install camel.js

###Setup

Require camel.js and create a new context:

var camel = require('camel.js');

context = new camel.context();

Create a new route and add it to the context

route = new camel.route();

route.from('file://source.txt')
     .to('file://result.txt');

context.addRoute(route);

Start the context

context.start();

This will execute a route that simply copies the source.txt contents to result.txt!

Routes are executed asynchronously, so adding a new route:

route2 = new camel.route();

route2.from('file://source2.txt')
      .to('file://result2.txt')
      .to('file://results2copy.txt');

context.addRoute(route2);

Will happen in parallel with the other routes!

##Supported Endpoints

###file://

The file endpoint can be used to read and write files.

Reading files

To read from a single file - from('file://source.txt')

To read all files in a directory - from('file://directoryNameHere')

To read all .txt files - from('file://directoryNameHere?fileFilter=*.txt')

Writing files

To write to a file, replacing all contents with the routes body - to('file://source.txt')

To write to a directory - to('file://directoryName')

##Camel.js Development

###Running tests

Tests are written using mocha and chai, you can run them with the command:

npm test

###Releasing a new version Run the following commands:

npm version patch -m "Upgrading to %s ..."
git push --tags

About

A camel-like routing and integration framework for node.js.

Resources

Stars

Watchers

Forks

Packages

No packages published