@oresoftware/express.fs.cache
TypeScript icon, indicating that this package has built-in type declarations

0.0.109 • Public • Published

@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().

Package Sidebar

Install

npm i @oresoftware/express.fs.cache

Weekly Downloads

2

Version

0.0.109

License

SEE LICENSE IN LICENSE.md

Unpacked Size

719 kB

Total Files

16

Last publish

Collaborators

  • oresoftware