Skip to content

Instantly share code, notes, and snippets.

@tywong
Created September 3, 2016 18:25
Show Gist options
  • Save tywong/fd8d0b35524ee716e01d944d798fc37f to your computer and use it in GitHub Desktop.
Save tywong/fd8d0b35524ee716e01d944d798fc37f to your computer and use it in GitHub Desktop.
const spawn = require('child-process-promise').spawn;
function convert(conf) {
let promise = spawn('convert', conf.cmd);
let proc = promise.childProcess;
let total = [];
proc.stdin.write(conf.bgImageStream);
proc.stdin.end();
proc.stdout.on('data', (data) => {
total.push(data);
});
return promise.then( () => {
conf.imageBuffer = Buffer.concat(total);
return conf;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment