Socket
Socket
Sign inDemoInstall

imagemin

Package Overview
Dependencies
Maintainers
6
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imagemin - npm Package Compare versions

Comparing version 5.3.1 to 6.0.0

12

index.js

@@ -47,3 +47,3 @@ 'use strict';

if (!Array.isArray(input)) {
return Promise.reject(new TypeError('Expected an array'));
return Promise.reject(new TypeError(`Expected an \`Array\`, got \`${typeof input}\``));
}

@@ -59,3 +59,3 @@

return globby(input, {nodir: true}).then(paths => Promise.all(paths.map(x => handleFile(x, output, opts))));
return globby(input, {onlyFiles: true}).then(paths => Promise.all(paths.map(x => handleFile(x, output, opts))));
};

@@ -65,3 +65,3 @@

if (!Buffer.isBuffer(input)) {
return Promise.reject(new TypeError('Expected a buffer'));
return Promise.reject(new TypeError(`Expected a \`Buffer\`, got \`${typeof input}\``));
}

@@ -72,5 +72,7 @@

const pipe = opts.plugins.length > 0 ? pPipe(opts.plugins)(input) : Promise.resolve(input);
if (opts.plugins.length === 0) {
return Promise.resolve(input);
}
return pipe.then(buf => buf.length < input.length ? buf : input);
return pPipe(opts.plugins)(input).then(buf => (buf.length < input.length ? buf : input));
};
{
"name": "imagemin",
"version": "5.3.1",
"description": "Minify images",
"license": "MIT",
"repository": "imagemin/imagemin",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
"url": "github.com/kevva"
},
"maintainers": [
{
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
{
"name": "Shinnosuke Watanabe",
"url": "github.com/shinnn"
}
],
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"minify",
"compress",
"image",
"images",
"jpeg",
"jpg",
"png",
"gif",
"svg"
],
"dependencies": {
"file-type": "^4.1.0",
"globby": "^6.1.0",
"make-dir": "^1.0.0",
"p-pipe": "^1.1.0",
"pify": "^2.3.0",
"replace-ext": "^1.0.0"
},
"devDependencies": {
"ava": "*",
"del": "^2.2.0",
"imagemin-jpegtran": "^5.0.0",
"imagemin-webp": "^4.0.0",
"is-jpg": "^1.0.0",
"tempy": "^0.1.0",
"xo": "*"
}
"name": "imagemin",
"version": "6.0.0",
"description": "Minify images",
"license": "MIT",
"repository": "imagemin/imagemin",
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"minify",
"compress",
"image",
"images",
"jpeg",
"jpg",
"png",
"gif",
"svg"
],
"dependencies": {
"file-type": "^8.1.0",
"globby": "^8.0.1",
"make-dir": "^1.0.0",
"p-pipe": "^1.1.0",
"pify": "^3.0.0",
"replace-ext": "^1.0.0"
},
"devDependencies": {
"ava": "*",
"del": "^3.0.0",
"imagemin-jpegtran": "^5.0.0",
"imagemin-webp": "^4.0.0",
"is-jpg": "^2.0.0",
"tempy": "^0.2.1",
"xo": "*"
}
}

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

# imagemin [![Build Status](https://img.shields.io/travis/imagemin/imagemin.svg)](https://travis-ci.org/imagemin/imagemin) [![Build status](https://ci.appveyor.com/api/projects/status/wlnem7wef63k4n1t?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/imagemin)
# imagemin [![Build Status](https://travis-ci.org/imagemin/imagemin.svg?branch=master)](https://travis-ci.org/imagemin/imagemin) [![Build status](https://ci.appveyor.com/api/projects/status/wlnem7wef63k4n1t?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/imagemin)

@@ -9,3 +9,3 @@ > Minify images seamlessly

```
$ npm install --save imagemin
$ npm install imagemin
```

@@ -21,11 +21,13 @@

imagemin(['images/*.{jpg,png}'], 'build/images', {
plugins: [
imageminJpegtran(),
imageminPngquant({quality: '65-80'})
]
}).then(files => {
(async () => {
const files = await imagemin(['images/*.{jpg,png}'], 'build/images', {
plugins: [
imageminJpegtran(),
imageminPngquant({quality: '65-80'})
]
});
console.log(files);
//=> [{data: <Buffer 89 50 4e …>, path: 'build/images/foo.jpg'}, …]
});
})();
```

@@ -36,3 +38,3 @@

### imagemin(input, output, [options])
### imagemin(input, [output], [options])

@@ -43,3 +45,3 @@ Returns `Promise<Object[]>` in the format `{data: Buffer, path: String}`.

Type: `Array`
Type: `string[]`

@@ -46,0 +48,0 @@ Files to be optimized. See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage).

Sorry, the diff of this file is not supported yet

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