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

Binary file not shown.

After

Width:  |  Height:  |  Size: 927 B

BIN
node_modules/jpegtran-bin/test/fixtures/test.jpg generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

45
node_modules/jpegtran-bin/test/test.js generated vendored Normal file
View File

@@ -0,0 +1,45 @@
'use strict';
const fs = require('fs');
const path = require('path');
const test = require('ava');
const execa = require('execa');
const tempy = require('tempy');
const binCheck = require('bin-check');
const binBuild = require('bin-build');
const compareSize = require('compare-size');
const jpegtran = require('..');
test('rebuild the jpegtran binaries', async t => {
const tmp = tempy.directory();
const cfg = [
'./configure --disable-shared',
`--prefix="${tmp}" --bindir="${tmp}"`
].join(' ');
await binBuild.url('https://downloads.sourceforge.net/project/libjpeg-turbo/1.5.1/libjpeg-turbo-1.5.1.tar.gz', [
cfg,
'make install'
]);
t.true(fs.existsSync(path.join(tmp, 'jpegtran')));
});
test('return path to binary and verify that it is working', async t => {
t.true(await binCheck(jpegtran, ['-version']));
});
test('minify a JPG', async t => {
const tmp = tempy.directory();
const src = path.join(__dirname, 'fixtures/test.jpg');
const dest = path.join(tmp, 'test.jpg');
const args = [
'-outfile',
dest,
src
];
await execa(jpegtran, args);
const res = await compareSize(src, dest);
t.true(res[dest] < res[src]);
});