Skip to content

High performance static assets cache for express that also supports compression and maxAge cache-control.

License

Notifications You must be signed in to change notification settings

swent/express-static-compress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-static-compress

High performance static assets cache for express that also supports compression and maxAge cache-control.

Example

const expressCache = require('express-static-compress');
const express = require('express');

const app = express();

app.use('/resources', expressCache('wwwresources-static-folder'));

Options

The cache will decently choose compression based on file type (currently only deflate is supported). Default maxAge cache-control is 14 days. Options can be set as second argument:

expressCache('wwwresources-static-folder', {
    maxAge: 60 * 60 * 24 * 365
});

expressCache('wwwresources-static-folder', {
    png: {
        compression: 'deflate'
    },
    css: {
        maxAge: 60 * 60
    }
});

Use value null to disable cache-control / compression.

About

High performance static assets cache for express that also supports compression and maxAge cache-control.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published