serve-webp
Create a new middleware function to serve images from within a given root directory. The images to serve will be determined by combining req.url with the provided root directory. When browser support webp,this module will convert the local images(jpg,gif,png) to webp and save into specify cache directory and response as webp,otherwise it will call next() to move on to the next middleware
Installation
npm install serve-webp
Usage
const serveWebp = ;const app = ;app;
config
root
images root directory
use path.join(root, req.url) as file path
cache
webp cache directory