mirror of https://gitgud.io/fatchan/gm
* Allow for first arg of gm() to be input stream, filename or width * Use 'spawn' instead of 'exec', arguments no longer need escaping * Retain original write() API for complete backwards compatibility * Add stream() method, returning stdout and stderr ReadableStreams * NPM now requires Node v0.4.2 * Upgrade gleak to 0.2.2master
parent
4590af660b
commit
6562ce9240
10 changed files with 173 additions and 49 deletions
@ -0,0 +1,12 @@ |
||||
|
||||
// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
|
||||
|
||||
var fs = require('fs'); |
||||
|
||||
module.exports = function (_, dir, finish, gm) { |
||||
|
||||
gm(fs.createReadStream(dir + '/original.jpg'), "original.jpg") |
||||
.write(dir + '/streamIn.png', function streamIn (err){ |
||||
finish(err); |
||||
}); |
||||
} |
@ -0,0 +1,16 @@ |
||||
|
||||
// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
|
||||
|
||||
var fs = require('fs'); |
||||
|
||||
module.exports = function (_, dir, finish, gm) { |
||||
|
||||
gm(fs.createReadStream(dir + '/original.jpg'), "original.jpg") |
||||
.stream(function streamOut (err, stdout, stderr){ |
||||
stdout.pipe(fs.createReadStream(dir + '/streamInOut.jpg')); |
||||
stdout.addListener('close', function() { |
||||
finish(err); |
||||
}); |
||||
}); |
||||
|
||||
} |
@ -0,0 +1,15 @@ |
||||
|
||||
// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
|
||||
|
||||
var fs = require('fs'); |
||||
|
||||
module.exports = function (gm, dir, finish) { |
||||
|
||||
gm |
||||
.stream(function streamOut (err, stdout, stderr){ |
||||
stdout.pipe(fs.createWriteStream(dir + '/streamOut.jpg')); |
||||
stdout.addListener('close', function() { |
||||
finish(err); |
||||
}); |
||||
}); |
||||
} |
Loading…
Reference in new issue