icdn

0.1.2 • Public • Published

Build Status Coverage Status npm version Maintainability Test Coverage dependencies Status devDependencies Status bundle size

icdn - dynamic image resizer with cdn options

Provides easy to use middleware, which will embed into your ecosystem and provide flexible image resizing options. All the requested images with allowed sizes and resolutions, will be created on fly, and than saved for future usage directly from static folder.

Basically algorithm is following:

  1. Hit the server with image url with desired image resolution (ex: https://yourdomain.com/trains/1024x0/megaTrain.png)
  2. Static server verifies if such image exists in path: public_folder/trains/1024x0/megaTrain.png
    • if yes - hit it directly from static folder
    • if no - ask image resizer to perform image resizing
  3. Resize Image
    • Read file from base src folder by a path src/trains/megaTrain.png
    • Resize file
    • Write file to public_folder/trains/1024x0/megaTrain.png
  4. Redirect to originalUrl with 301 status code: (ex: https://yourdomain.com/trains/1024x0/megaTrain.png)

Integrations

So far we do have few integrations:

  • express.js
  • fastify.js
  • vanilla.js

But much more are coming! In particular:

  • AWS CloudFront + AWS Lambda integration
  • GCP Cloud CDN + GCP Functions integration

Package Sidebar

Install

npm i icdn

Weekly Downloads

4

Version

0.1.2

License

MIT

Unpacked Size

166 kB

Total Files

9

Last publish

Collaborators

  • rk.xtd