task-pipeline

A node-task for running node-task pipelines.

npm install task-pipeline
2 downloads in the last week
4 downloads in the last month

task-pipeline

A node-task for running node-task pipelines.

var task = require('task-pipeline');
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: '(',
      footer: ')'
    }
  },
  write: {
    task: require('task-write'),
    options: {
      use: require('recordio-file')
    }
  }
};

task.run({
  tasks: tasks,
  input: {
    src: ['test/fixtures/foo.txt','test/fixtures/bar.txt'],
    dest: 'tmp/test.txt'
  },
  pipeline: ['read', 'concat', 'wrap', 'write']
});

// recursive pipelines for sources
task.run({
  tasks: tasks,
  input: {
    src: [
      {
        input: {
          src: ['test/fixtures/foo.txt','test/fixtures/bar.txt']
        },
        pipeline: ['read', 'concat', 'wrap']
      },
      {
        input: {
          src: ['test/fixtures/baz.txt','test/fixtures/qux.txt']
        },
        pipeline: ['read','concat','wrap']
      }
    ],
    dest: 'tmp/combined.txt'
  },
  pipeline: ['concat', 'wrap', 'write']
})
npm loves you