@oresoftware/express.fs.cache

Semver-oriented TypeScript library skeleton.

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
121Feb 24, 2020Apr 9, 2018Minified + gzip package size for @oresoftware/express.fs.cache in KB

Readme

@oresoftware/express.fs.cache

Use Express middleware to cache and serve static assets

Installation: npm install @oresoftware/express.fs.cache


import express = require('express');
import fsCache from '@oresoftware/express.fs.cache';


app.use('/public', fsCache(path.join(__dirname, 'public')));
app.use('/public', express.static(path.join(__dirname, 'public')));

If the files are in the cache, they will get served by the cache. Given the above code, we would cache all .js, .html, .css files in the public directory. The cached files would be served from an in-memory cache.

If for some reason, a file is not in the cache, then the regular express static middleware would pick up where we left off.

This middleware never calls next(err), only next().

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.