Socket
Socket
Sign inDemoInstall

ipx

Package Overview
Dependencies
124
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ipx

[![NPM Vernion](https://flat.badgen.net/npm/v/ipx)](https://www.npmjs.com/package/ipx) [![NPM Downloads](https://flat.badgen.net/npm/dt/ipx)](https://www.npmjs.com/package/ipx) [![Package Size](https://flat.badgen.net/packagephobia/install/ipx)](https://p


Version published
Maintainers
1
Install size
27.5 MB
Created

Changelog

Source

1.0.0-0 (2022-11-23)

Bug Fixes

  • use utc format for Last-Modified header (#89) (1cb0b6d)

Readme

Source

IPX

NPM Vernion NPM Downloads Package Size

High performance, secure and easy to use image proxy based on sharp and libvips.

Usage

Quick Start

You can use ipx command to start server using:

$ npx ipx

The default server directory is the current working directory.

Programatic Usage

You can use IPX as a Connect/Express middleware or directly use ipx api.

import { createIPX, createIPXMiddleware } from "ipx";

const ipx = createIPX(/* options */);
const app = express();
app.use("/image", createIPXMiddleware(ipx));

Examples

The examples assume that a static folder with buffalo.png file is present in the directory where IPX server is running.

Get original image:

http://localhost:3000/_/static/buffalo.png

Change format to webp and keep other things same as source:

http://localhost:3000/f_webp/static/buffalo.png

Keep original format (png) and set width to 200:

http://localhost:3000/w_200/static/buffalo.png

Resize to 200x200px using embed method and change format to webp:

http://localhost:3000/embed,f_webp,s_200x200/static/buffalo.png

Modifiers

PropertyDocsExampleComments
width / wDocshttp://localhost:3000/width_200/buffalo.png
height / hDocshttp://localhost:3000/height_200/buffalo.png
resize / sDocshttp://localhost:3000/s_200x200/buffalo.png
fitDocshttp://localhost:3000/s_200x200,fit_outside/buffalo.pngSets fit option for resize.
position / posDocshttp://localhost:3000/s_200x200,pos_top/buffalo.pngSets position option for resize.
trimDocshttp://localhost:3000/trim_100/buffalo.png
formatDocshttp://localhost:3000/format_webp/buffalo.pngSupported format: jpg, jpeg, png, webp, avif, gif, heif
quality / q_http://localhost:3000/quality_50/buffalo.pngAccepted values: 0 to 100
rotateDocshttp://localhost:3000/rotate_45/buffalo.png
enlarge_http://localhost:3000/enlarge,s_2000x2000/buffalo.pngAllow the image to be upscaled. By default the returned image will never be larger than the source in any dimension, while preserving the requested aspect ratio.
flipDocshttp://localhost:3000/flip/buffalo.png
flopDocshttp://localhost:3000/flop/buffalo.png
sharpenDocshttp://localhost:3000/sharpen_30/buffalo.png
medianDocshttp://localhost:3000/median_10/buffalo.png
gammaDocshttp://localhost:3000/gamma_3/buffalo.png
negateDocshttp://localhost:3000/negate/buffalo.png
normalizeDocshttp://localhost:3000/normalize/buffalo.png
thresholdDocshttp://localhost:3000/threshold_10/buffalo.png
tintDocshttp://localhost:3000/tint_1098123/buffalo.png
grayscaleDocshttp://localhost:3000/grayscale/buffalo.png
animated-http://localhost:3000/animated/buffalo.gifExperimental

Config

Config can be customized using IPX_* environment variables.

  • IPX_DIR

    • Default: . (current working directory)
  • IPX_DOMAINS

    • Default: []

License

MIT

FAQs

Last updated on 23 Nov 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