Created
September 3, 2016 18:25
-
-
Save tywong/fd8d0b35524ee716e01d944d798fc37f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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