This commit is contained in:
2021-11-21 11:18:28 +01:00
parent 7a358eb836
commit 230b10b2a3
9339 changed files with 892519 additions and 62 deletions

39
node_modules/imagemin-jpegtran/index.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
'use strict';
const execBuffer = require('exec-buffer');
const isJpg = require('is-jpg');
const jpegtran = require('jpegtran-bin');
module.exports = opts => buf => {
opts = Object.assign({}, opts);
if (!Buffer.isBuffer(buf)) {
return Promise.reject(new TypeError('Expected a buffer'));
}
if (!isJpg(buf)) {
return Promise.resolve(buf);
}
const args = ['-copy', 'none'];
if (opts.progressive) {
args.push('-progressive');
}
if (opts.arithmetic) {
args.push('-arithmetic');
} else {
args.push('-optimize');
}
args.push('-outfile', execBuffer.output, execBuffer.input);
return execBuffer({
input: buf,
bin: jpegtran,
args
}).catch(error => {
error.message = error.stderr || error.message;
throw error;
});
};