Socket
Socket
Sign inDemoInstall

imagemin-sharp

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    imagemin-sharp

Imagemin plugin for `sharp`


Version published
Weekly downloads
13
increased by30%
Maintainers
1
Install size
19.8 MB
Created
Weekly downloads
 

Readme

Source

imagemin-sharp

Imagemin plugin for sharp

Installation

npm install imagemin-sharp --save

Usage

import imagemin from "imagemin";
import imageminSharp from "imagemin-sharp";

const files = await imagemin(["images/*.{jpg,png}"], {
  destination: "build/images",
  plugins: [
    imageminSharp({
      chainSharp: async (sharp) => {
        const meta = await sharp.metadata();
        if (meta.width > 1000) {
          return sharp.flip().resize({ width: 1000 });
        }
        return sharp.flip();
      },
    }),
  ],
});

console.log(files);

Options

Options is a union of chainSharp and SharpOptions

  • chainSharp: A callback to chain operate sharp instance, return Sharp | Promise<Sharp>
  • SharpOptions: Sharp constructor options, can referrer https://sharp.pixelplumbing.com/api-constructor

License

MIT

Keywords

FAQs

Last updated on 28 Apr 2022

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