Socket
Socket
Sign inDemoInstall

imagemin

Package Overview
Dependencies
23
Maintainers
3
Versions
48
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    imagemin

Minify images


Version published
Maintainers
3
Install size
259 kB
Created

Readme

Source

imagemin Build Status Build status

Minify images seamlessly

Install

$ npm install --save imagemin

Usage

const imagemin = require('imagemin');
const imageminMozjpeg = require('imagemin-mozjpeg');
const imageminPngquant = require('imagemin-pngquant');

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

API

imagemin(input, output, [options])

Returns a promise for an array of objects in the format {data: Buffer, path: String}.

input

Type: array

Files to be optimized. See supported minimatch patterns.

output

Type: string

Set the destination folder to where your files will be written. If no destination is specified no files will be written.

options
plugins

Type: array

Array of plugins to use.

imagemin.buffer(buffer, [options])

Returns a promise for a buffer.

buffer

Type: buffer

The buffer to optimize.

options
plugins

Type: array

Array of plugins to use.

License

MIT © imagemin

Keywords

FAQs

Last updated on 27 May 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc