Skip to content

Commit

Permalink
Optimize images in memory
Browse files Browse the repository at this point in the history
  • Loading branch information
kevva committed Oct 3, 2019
1 parent c5c090d commit ac13852
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const execBuffer = require('exec-buffer');
const execa = require('execa');
const gifsicle = require('gifsicle');
const isGif = require('is-gif');

Expand All @@ -26,14 +26,9 @@ module.exports = (options = {}) => input => {
args.push(`--colors=${options.colors}`);
}

args.push('--output', execBuffer.output, execBuffer.input);

return execBuffer({
args,
bin: gifsicle,
return execa(gifsicle, args, {
encoding: null,
input
}).catch(error => {
error.message = error.stderr || error.message;
throw error;
});
})
.then(({stdout}) => stdout);
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"optimize"
],
"dependencies": {
"exec-buffer": "^3.0.0",
"execa": "^1.0.0",
"gifsicle": "^4.0.0",
"is-gif": "^3.0.0"
},
Expand Down

0 comments on commit ac13852

Please sign in to comment.