New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mozjpeg

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mozjpeg - npm Package Compare versions

Comparing version 0.1.9 to 0.1.10

lib/index.js

61

index.js
'use strict';
var BinBuild = require('bin-build');
var BinWrapper = require('bin-wrapper');
var fs = require('fs');
var logSymbols = require('log-symbols');
var path = require('path');
var pkg = require('./package.json');
var bin = require('./lib');
/**
* Variables
*/
var BIN_VERSION = '2.1';
var BASE_URL = 'https://raw.github.com/kevva/mozjpeg/v' + pkg.version + '/vendor/';
/**
* Initialize a new BinWrapper
*/
var bin = new BinWrapper({ global: false })
.src(BASE_URL + 'linux/jpegtran', 'linux')
.src(BASE_URL + 'win/jpegtran.exe', 'win32')
.dest(path.join(__dirname, 'vendor'))
.use(process.platform === 'win32' ? 'jpegtran.exe' : 'jpegtran');
/**
* Only run check if binary doesn't already exist
*/
fs.exists(bin.use(), function (exists) {
if (!exists) {
var args = [
'-copy', 'none',
'-outfile', path.join(__dirname, 'test/fixtures/test-optimized.jpg'),
path.join(__dirname, 'test/fixtures/test.jpg')
];
bin.run(args, function (err) {
if (err) {
console.log(logSymbols.warning + ' pre-build test failed, compiling from source...');
var builder = new BinBuild()
.src('https://github.com/mozilla/mozjpeg/archive/v' + BIN_VERSION + '.tar.gz')
.cmd('autoreconf -fiv && ./configure --disable-shared --prefix="' + bin.dest() + '" --bindir="' + bin.dest() + '" --libdir="' + bin.dest() + '"')
.cmd('make && make install');
return builder.build(function (err) {
if (err) {
return console.log(logSymbols.error, err);
}
console.log(logSymbols.success + ' mozjpeg built successfully!');
});
}
console.log(logSymbols.success + ' pre-build test passed successfully!');
});
}
});
/**
* Module exports
*/
module.exports.path = bin.use();
module.exports.path = bin.path();
{
"name": "mozjpeg",
"version": "0.1.9",
"version": "0.1.10",
"description": "mozjpeg wrapper that makes it seamlessly available as a local dependency",
"license": "MIT",
"repository": "kevva/mozjpeg",
"repository": "imagemin/mozjpeg-bin",
"author": {

@@ -19,3 +19,3 @@ "name": "Kevin Mårtensson",

"scripts": {
"postinstall": "node index.js",
"postinstall": "node lib/install.js",
"test": "mocha --reporter list --timeout 150000"

@@ -26,2 +26,3 @@ },

"index.js",
"lib",
"test"

@@ -41,3 +42,3 @@ ],

"bin-build": "^0.2.0",
"bin-wrapper": "^0.3.0",
"bin-wrapper": "^0.4.0",
"log-symbols": "^1.0.0"

@@ -44,0 +45,0 @@ },

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

# mozjpeg [![Build Status](https://secure.travis-ci.org/kevva/mozjpeg.svg?branch=master)](http://travis-ci.org/kevva/mozjpeg)
# mozjpeg-bin [![Build Status](https://secure.travis-ci.org/imagemin/mozjpeg-bin.svg?branch=master)](http://travis-ci.org/imagemin/mozjpeg-bin)

@@ -3,0 +3,0 @@ > mozjpeg is a production-quality JPEG encoder that improves compression while maintaining compatibility with the vast majority of deployed decoders

@@ -0,0 +0,0 @@ /*global afterEach, beforeEach, describe, it */

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