1.2.0 • Published 3 years ago

optimize-images v1.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

Optimize Images

Github npm Build status Test coverage License

API

const optimizeImages = require('optimize-images')

optimizeImage(root, tinypngApiKey, options)

Middleware optimizes the images from root directory, save them to disk and then serves the optimized images.

Example

const express = require('express')
const optimizeImages = require('optimize-images')

const app = express()

//generate from https://tinypng.com/developers
const tinypngApiKey = "YOUR_API_SECRET_KEY"
const root = "public"
const options = {
  dirName: "optimized-images" 
}

app.use(optimizeImages(root, tinypngApiKey, options)