0.1.0 • Published 12 years ago
pipeliner v0.1.0
pipeliner
Chain the execution of node-tasks.
API
pipeliner.run
Given a series of task configurations and some input, pass input into the first task, then run each subsequent task using the output of the previous task as the input for the next. Returns the return value of the last task in the pipeline.
pipeliner.run(pipeline, input)pipelineAn array of objects with ataskandoptionskey, where task is a valid node-task and options are the options to pass to it when it is run.inputThe input for the first task in the pipeline.
var pipeline = [
{ task: require('task-read'),
options: {
use: require('recordio-file')
}
},
{ task: require('task-concat'),
options: {
separator: '-'
}
},
{ task: require('task-wrap'),
options: {
header: '//header',
footer: '//footer'
}
},
{ task: require('task-write'),
options: {
use: require('recordio-file')
}
}
];
var input = [{
src: ['test/fixtures/foo.txt',
'test/fixtures/bar.txt',
'test/fixtures/baz.txt'],
dest: 'tmp/output.txt'
}];
pipeliner(pipeline, input);pipeliner.plumb
A convenience method to make creating pipeline configurations easier. Returns a pipeline which can be passed to pipeliner.run.
pipeliner.plumb(tasks, pipelines)tasksAn object containing tasks to be mapped into a pipeline.pipelineAn array of task names that correspond to keys in thetasksargument.
var tasks = {
read: {
task: require('task-read'),
options: {
use: require('recordio-file')
}
},
concat: {
task: require('task-concat'),
options: {
separator: '-'
}
},
wrap: {
task: require('task-wrap'),
options: {
header: '//header',
footer: '//footer'
}
},
write: {
task: require('task-write'),
options: {
use: require('recordio-file')
}
}
};
var pipeline = ['read', 'concat', 'wrap', 'write'];
pipeliner.plumb(tasks, pipeline);0.1.0
12 years ago