Run a buffer through a child process


Run a Buffer through a child process

$ npm install --save exec-buffer
var ExecBuffer = require('exec-buffer');
var fs = require('fs');
var gifsicle = require('gifsicle').path;
var execBuffer = new ExecBuffer();
execBuffer.use(gifsicle, ['-o', execBuffer.dest(), execBuffer.src()]);
execBuffer.run(fs.readFileSync('test.gif'), function (errdata) {
if (err) {
throw err;
//=> <Buffer 47 49 46 38 37 61 ...> 

Creates a new ExecBuffer instance.

Type: String

Path to the binary.

Type: Array

Arguments to run the binary with.

Type: String

Set or get the temporary source path.

Type: String

Set or get the temporary destination path.

Type: Buffer

The Buffer to be ran through the child process.

Type: Function

Returns a Buffer with the new data and any stderr output.

MIT © Kevin Mårtensson