Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zimg

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zimg

Pre-optimize images for Next.js production or others via sharp

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

zimg

Build Status License NPM Version NPM Downloads Dependency Status Code Style

Pre-optimize images for Next.js production or others via sharp

Installation

$ npm install zimg

CLI Usage

Use npx:

$ npx zimg <cwd> [options]

Globally install:

$ npm install zimg -g
$ zimg --help
zimg/0.1.0

Usage:
  $ zimg [cwd]

Commands:
  [cwd]  Optimize images for production via sharp

For more info, run any command with the `--help` flag:
  $ zimg --help

Options:
  -p, --pattern <pattern>  Glob pattern to match files, default to `**/*.{jpg,jpeg,png}`
  -s, --sizes <sizes>      Sizes to generate, default to `[640, 720, 1280, 1600]`
  -q, --quality <quality>  Quality of generated images, default to `75`
  -v, --version            Display version number
  -h, --help               Display this message

API Usage

import { zimg } from 'zimg'
await zimg({
  cwd: process.cwd(),
  pattern: '**/*.{jpg,jpeg,png}',
  sizes: [640, 720, 1280, 1600],
  quality: 75
})
// searching images in cwd, and resize it

API Reference

zimg(options?)

options
cwd
  • Type: string
  • Details: Current working directory
  • Default: process.cwd()
pattern
  • Type: string
  • Details: Glob pattern to match files
  • Default: '**/*.{jpg,jpeg,png}'
filename
  • Type: string
  • Details: Filename of optimized image
  • Default: '[name].[size]'
sizes
  • Type: number[]
  • Details: Sizes to generate
  • Default: [640, 720, 1280, 1600]
quality
  • Type: number
  • Details: Quality of generated images
  • Default: 75
skipOptimized
  • Type: boolean
  • Details: Skip optimized images rather than overwrite
  • Default: true
  • zce/velite - Turns Markdown / MDX, YAML, JSON, or others into app's data layer with Zod schema.
  • zce/caz - A simple yet powerful template-based Scaffolding tools.

Contributing

  1. Fork it on GitHub!
  2. Clone the fork to your own machine.
  3. Checkout your feature branch: git checkout -b my-awesome-feature
  4. Commit your changes to your own branch: git commit -am 'Add some feature'
  5. Push your work back up to your fork: git push -u origin my-awesome-feature
  6. Submit a Pull Request so that we can review your changes.

NOTE: Be sure to merge the latest from "upstream" before making a pull request!

License

MIT © zce

Keywords

FAQs

Package last updated on 25 Feb 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc