Generate imgproxy url in browser and Node easily. Lightweight and Fast!
npm install @misaon/imgproxy[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions][github-actions-src]][github-actions-href]
[![Codecov][codecov-src]][codecov-href]
> Generate imgproxy url in browser and Node easily. Lightweight and Fast!
- ๐ 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%
Install package:
``shnpm
npm install @misaon/imgproxy
then in your code:
`js
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)
`$3
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`Made with ๐งก by @misaon
Published under MIT License.
[npm-version-src]: https://img.shields.io/npm/v/@misaon/imgproxy?style=flat-square
[npm-version-href]: https://npmjs.com/package/@misaon/imgproxy
[npm-downloads-src]: https://img.shields.io/npm/dm/@misaon/imgproxy?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/@misaon/imgproxy
[github-actions-src]: https://img.shields.io/github/actions/workflow/status/misaon/imgproxy/ci.yml?branch=main&style=flat-square
[github-actions-href]: https://github.com/misaon/imgproxy/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/gh/misaon/imgproxy/main?style=flat-square
[codecov-href]: https://codecov.io/gh/misaon/imgproxy