slicica 
diminutive for image in croatian
Image serving/resizing/optimizing Express/Connect middleware using sharp/libvips.
Intended for usage behind a proxy cache (e.g. nginx, varnish) or a CDN (e.g. CloudFlare) as it doesn't cache results on its own.
Install
npm add slicica
Installing this module will automatically fetch and build libvips and its dependencies on Linux, MacOS and Windows x64.
For more information read sharp's documentation.
Usage
app.use(require('slicica')(options))
const app = express()
const slicica = require('slicica')
app.use(
slicica(
{
prefix: '/',
root: '',
maxAge: 0,
progressive: false,
quality: 80,
compression: 6,
etag: true,
lastModified: true,
cache: false,
concurrency: 0,
contentTypes: ['image/jpeg', 'image/png', 'image/webp', 'image/tiff'],
},
),
)
Request example
http://localhost:####/images/random.jpg?w=800
http://localhost:####/images/random.jpg?h=600
http://localhost:####/images/random.jpg?w=300&h=200&g=north
w
h
g = 'center'
if (w && h) {
} else if (w || h) {
} else {
}
License
MIT © Stipe Kotarac (https://github.com/kotarac)