@misaon/imgproxy
v1.0.1
Published
Generate imgproxy url in browser and Node easily. Lightweight and Fast!
Readme
🖼️ @misaon/imgproxy
Generate imgproxy url in browser and Node easily. Lightweight and Fast!
Features
- 👌 Zero configuration
- 🪄 Modern, tiny and tree shaken code
- ⚙️ Written in TypeScript
- 🕒 Async-less methods and crypto computing
- 🚀 Browser and Node support
- 📦 Extendable and customizable
- 📰 Compatible with the latest version of imgproxy
- 🧪 Covered by tests
>99%
Usage
Install package:
# npm
npm install @misaon/imgproxy
# yarn
yarn add @misaon/imgproxy
# pnpm
pnpm install @misaon/imgproxythen in your code:
import { getImageUrl } from '@misaon/imgproxy'
// or commonJS
// const { getImageUrl } = require("misaon/imgproxy");
const imageUrl = getImageUrl(sourceImageUrl, {
baseURL: 'https://my-imgproxy.com', // optional
secret: 'imgproxy-secret-key',
salt: 'imgproxy-salt',
modifiers: {
width: '100',
height: '75',
// other modifiers... (see below)
}
})
console.log(imageUrl)Modifiers
The list of modifiers that you can use is well typed and can be found here or in imgproxy docs.
Development
- Clone this repository
- Install latest LTS version of Node.js
- Enable Corepack using
corepack enable - Install dependencies using
pnpm install - Run interactive tests using
pnpm dev
License
Made with 🧡 by @misaon
Published under MIT License.
