![Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack](https://cdn.sanity.io/images/cgdhsj6q/production/6af25114feaaac7179b18127c83327568ff592d1-1024x1024.webp?w=800&fit=max&auto=format)
Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
ipx
Advanced tools
Changelog
v1.3.0
kernel
modifier (#143)background
modifier example (2c6ad22)h3
middleware example (#144)Readme
High performance, secure and easy to use image proxy based on sharp and libvips.
You can use ipx
command to start server using:
npx ipx@latest
The default server directory is the current working directory.
You can use IPX as a middleware or directly use IPX interface.
import { createIPX, createIPXMiddleware } from "ipx";
const ipx = createIPX({ domains: ["unjs.io"] });
// (req, res) => void
const ipxMiddleware = createIPXMiddleware(ipx);
Example: Using with unjs/h3:
import { createIPX, createIPXMiddleware } from "ipx";
import { listen } from "listhen";
import { createApp, fromNodeMiddleware, toNodeListener } from "h3";
const ipx = createIPX({});
const ipxMiddleware = createIPXMiddleware(ipx);
const app = createApp().use("/", fromNodeMiddleware(ipxMiddleware));
listen(toNodeListener(app));
Example: Using express:
import { createIPX, createIPXMiddleware } from "ipx";
import { listen } from "listhen";
import express from "express";
const ipx = createIPX({});
const ipxMiddleware = createIPXMiddleware(ipx);
const app = express().use("/", ipxMiddleware);
listen(app);
Get original image:
/_/static/buffalo.png
Change format to webp
and keep other things same as source:
/f_webp/static/buffalo.png
Keep original format (png
) and set width to 200
:
/w_200/static/buffalo.png
Resize to 200x200px
using embed
method and change format to webp
:
/embed,f_webp,s_200x200/static/buffalo.png
Property | Docs | Example | Comments |
---|---|---|---|
width / w | Docs | /width_200/buffalo.png | |
height / h | Docs | /height_200/buffalo.png | |
resize / s | Docs | /s_200x200/buffalo.png | |
kernel | Docs | /s_200x200,kernel_nearest/buffalo.png | Supported kernel: nearest , cubic , mitchell , lanczos2 and lanczos3 (default). |
fit | Docs | /s_200x200,fit_outside/buffalo.png | Sets fit option for resize . |
position / pos | Docs | /s_200x200,pos_top/buffalo.png | Sets position option for resize . |
trim | Docs | /trim_100/buffalo.png | |
extend | Docs | /extend_{top}_{right}_{bottom}_{left}/buffalo.png | Extend / pad / extrude one or more edges of the image with either the provided background colour or pixels derived from the image. |
background / b | _ | /r_45,b_00ff00/buffalo.png | |
extract | Docs | /extract_{left}_{top}_{width}_{height}/buffalo.png | Extract/crop a region of the image. |
format / f | Docs | /format_webp/buffalo.png | Supported format: jpg , jpeg , png , webp , avif , gif , heif , tiff and auto (experimental only with middleware) |
quality / q | _ | /quality_50/buffalo.png | Accepted values: 0 to 100 |
rotate | Docs | /rotate_45/buffalo.png | |
enlarge | _ | /enlarge,s_2000x2000/buffalo.png | Allow 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. |
flip | Docs | /flip/buffalo.png | |
flop | Docs | /flop/buffalo.png | |
sharpen | Docs | /sharpen_30/buffalo.png | |
median | Docs | /median_10/buffalo.png | |
blur | Docs | /blur_5/buffalo.png | |
gamma | Docs | /gamma_3/buffalo.png | |
negate | Docs | /negate/buffalo.png | |
normalize | Docs | /normalize/buffalo.png | |
threshold | Docs | /threshold_10/buffalo.png | |
tint | Docs | /tint_1098123/buffalo.png | |
grayscale | Docs | /grayscale/buffalo.png | |
animated | - | /animated/buffalo.gif | Experimental |
Config can be customized using IPX_*
environment variables.
IPX_DIR
.
(current working directory)IPX_DOMAINS
[]
IPX_MAX_AGE
300
IPX_ALIAS
{}
IPX_FETCH_OPTIONS
{}
FAQs
High performance, secure and easy-to-use image optimizer.
The npm package ipx receives a total of 208,649 weekly downloads. As such, ipx popularity was classified as popular.
We found that ipx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.