Product Promotion
0x5a.live
for different kinds of informations and explorations.
GitHub - imagemin/imagemin: [Unmaintained] Minify images seamlessly
[Unmaintained] Minify images seamlessly. Contribute to imagemin/imagemin development by creating an account on GitHub.
Visit SiteGitHub - imagemin/imagemin: [Unmaintained] Minify images seamlessly
[Unmaintained] Minify images seamlessly. Contribute to imagemin/imagemin development by creating an account on GitHub.
Powered by 0x5a.live ๐
imagemin
Minify images seamlessly
Install
npm install imagemin
Usage
import imagemin from 'imagemin';
import imageminJpegtran from 'imagemin-jpegtran';
import imageminPngquant from 'imagemin-pngquant';
const files = await imagemin(['images/*.{jpg,png}'], {
destination: 'build/images',
plugins: [
imageminJpegtran(),
imageminPngquant({
quality: [0.6, 0.8]
})
]
});
console.log(files);
//=> [{data: <Uint8Array 89 50 4e โฆ>, destinationPath: 'build/images/foo.jpg'}, โฆ]
API
imagemin(input, options?)
Returns Promise<object[]>
in the format {data: Uint8Array, sourcePath: string, destinationPath: string}
.
input
Type: string[]
File paths or glob patterns.
options
Type: object
destination
Type: string
Set the destination folder to where your files will be written. If no destination is specified, no files will be written.
plugins
Type: Array
The plugins to use.
glob
Type: boolean
Default: true
Enable globbing when matching file paths.
imagemin.buffer(data, options?)
Returns Promise<Uint8Array>
.
data
Type: Uint8Array
The image data to optimize.
options
Type: object
plugins
Type: Array
Plugins to use.
Related
- imagemin-cli - CLI for this module
- gulp-imagemin - Gulp plugin
NodeJS Resources
are all listed below.
Made with โค๏ธ
to provide different kinds of informations and resources.