Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jpegtran-bin

Package Overview
Dependencies
Maintainers
7
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jpegtran-bin - npm Package Compare versions

Comparing version 5.0.2 to 6.0.0

6

cli.js
#!/usr/bin/env node
'use strict';
const {spawn} = require('child_process');
const jpegtran = require('.');
import {spawn} from 'node:child_process';
import process from 'node:process';
import jpegtran from './index.js';

@@ -6,0 +6,0 @@ const input = process.argv.slice(2);

@@ -1,2 +0,3 @@

'use strict';
module.exports = require('./lib').path();
import lib from './lib/index.js';
export default lib.path();

@@ -1,9 +0,10 @@

'use strict';
const path = require('path');
const BinWrapper = require('bin-wrapper');
const pkg = require('../package.json');
import fs from 'node:fs';
import process from 'node:process';
import {fileURLToPath} from 'node:url';
import BinWrapper from 'bin-wrapper';
const pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)));
const url = `https://raw.githubusercontent.com/imagemin/jpegtran-bin/v${pkg.version}/vendor/`;
module.exports = new BinWrapper()
const binWrapper = new BinWrapper()
.src(`${url}macos/jpegtran`, 'darwin')

@@ -20,3 +21,5 @@ .src(`${url}linux/x86/jpegtran`, 'linux', 'x86')

.src(`${url}win/x64/libjpeg-62.dll`, 'win32', 'x64')
.dest(path.join(__dirname, '../vendor'))
.dest(fileURLToPath(new URL('../vendor', import.meta.url)))
.use(process.platform === 'win32' ? 'jpegtran.exe' : 'jpegtran');
export default binWrapper;

@@ -1,6 +0,5 @@

'use strict';
const path = require('path');
const binBuild = require('bin-build');
const log = require('logalot');
const bin = require('.');
import process from 'node:process';
import {fileURLToPath} from 'node:url';
import binBuild from 'bin-build';
import bin from './index.js';

@@ -12,28 +11,29 @@ const args = [

'-outfile',
path.join(__dirname, '../test/fixtures/test-optimized.jpg'),
path.join(__dirname, '../test/fixtures/test.jpg')
fileURLToPath(new URL('../test/fixtures/test-optimized.jpg', import.meta.url)),
fileURLToPath(new URL('../test/fixtures/test.jpg', import.meta.url)),
];
bin.run(args).then(() => {
log.success('jpegtran pre-build test passed successfully');
console.log('jpegtran pre-build test passed successfully');
}).catch(async error => {
log.warn(error.message);
log.warn('jpegtran pre-build test failed');
log.info('compiling from source');
console.warn(error.message);
console.warn('jpegtran pre-build test failed');
console.info('compiling from source');
const cfg = [
'./configure --disable-shared',
`--prefix="${bin.dest()}" --bindir="${bin.dest()}"`
`--prefix="${bin.dest()}" --bindir="${bin.dest()}"`,
].join(' ');
try {
await binBuild.file(path.resolve(__dirname, '../vendor/source/libjpeg-turbo-1.5.1.tar.gz'), [
const source = fileURLToPath(new URL('../vendor/source/libjpeg-turbo-1.5.1.tar.gz', import.meta.url));
await binBuild.file(source, [
'touch configure.ac aclocal.m4 configure Makefile.am Makefile.in',
cfg,
'make install'
'make install',
]);
log.success('jpegtran built successfully');
console.log('jpegtran built successfully');
} catch (error) {
log.error(error.stack);
console.error(error.stack);

@@ -40,0 +40,0 @@ // eslint-disable-next-line unicorn/no-process-exit

{
"name": "jpegtran-bin",
"version": "5.0.2",
"version": "6.0.0",
"description": "jpegtran (part of libjpeg-turbo) bin-wrapper that makes it seamlessly available as a local dependency",
"license": "MIT",
"repository": "imagemin/jpegtran-bin",
"type": "module",
"author": {

@@ -27,7 +28,7 @@ "name": "Sindre Sorhus",

"engines": {
"node": ">=10"
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"scripts": {
"postinstall": "node lib/install.js",
"test": "xo && ava --timeout=120s"
"test": "xo && ava --timeout=180s"
},

@@ -54,13 +55,12 @@ "files": [

"bin-build": "^3.0.0",
"bin-wrapper": "^4.0.0",
"logalot": "^2.0.0"
"bin-wrapper": "^4.0.0"
},
"devDependencies": {
"ava": "^3.8.0",
"ava": "^3.15.0",
"bin-check": "^4.0.1",
"compare-size": "^3.0.0",
"execa": "^4.0.0",
"tempy": "^0.5.0",
"xo": "^0.30.0"
"execa": "^5.1.1",
"tempy": "^2.0.0",
"xo": "^0.45.0"
}
}

@@ -1,2 +0,2 @@

# jpegtran-bin [![Build Status](https://travis-ci.org/imagemin/jpegtran-bin.svg?branch=master)](https://travis-ci.org/imagemin/jpegtran-bin)
# jpegtran-bin ![GitHub Actions Status](https://github.com/imagemin/jpegtran-bin/workflows/test/badge.svg?branch=main)

@@ -18,4 +18,4 @@ > [libjpeg-turbo](http://libjpeg-turbo.virtualgl.org/) is a derivative of libjpeg that uses SIMD instructions (MMX, SSE2, NEON) to accelerate baseline JPEG compression and decompression on x86, x86-64, and ARM systems. On such systems, libjpeg-turbo is generally 2-4x as fast as the unmodified version of libjpeg, all else being equal.

```js
const {execFile} = require('child_process');
const jpegtran = require('jpegtran-bin');
import {execFile} from 'node:child_process';
import jpegtran from 'jpegtran-bin';

@@ -22,0 +22,0 @@ execFile(jpegtran, ['-outfile', 'output.jpg', 'input.jpg'], error => {

@@ -1,22 +0,30 @@

'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('..');
import fs from 'node:fs';
import path from 'node:path';
import process from 'node:process';
import {fileURLToPath} from 'node:url';
import test from 'ava';
import execa from 'execa';
import tempy from 'tempy';
import binCheck from 'bin-check';
import binBuild from 'bin-build';
import compareSize from 'compare-size';
import jpegtran from '../index.js';
test('rebuild the jpegtran binaries', async t => {
// Skip the test on Windows
if (process.platform === 'win32') {
t.pass();
return;
}
const temporary = tempy.directory();
const cfg = [
'./configure --disable-shared',
`--prefix="${temporary}" --bindir="${temporary}"`
`--prefix="${temporary}" --bindir="${temporary}"`,
].join(' ');
const source = fileURLToPath(new URL('../vendor/source/libjpeg-turbo-1.5.1.tar.gz', import.meta.url));
await binBuild.file(path.resolve(__dirname, '../vendor/source/libjpeg-turbo-1.5.1.tar.gz'), [
await binBuild.file(source, [
cfg,
'make install'
'make install',
]);

@@ -33,3 +41,3 @@

const temporary = tempy.directory();
const src = path.join(__dirname, 'fixtures/test.jpg');
const src = fileURLToPath(new URL('fixtures/test.jpg', import.meta.url));
const dest = path.join(temporary, 'test.jpg');

@@ -39,3 +47,3 @@ const args = [

dest,
src
src,
];

@@ -42,0 +50,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc