Noodles Practicing Medicine

    express-static-compress

    1.0.5 • Public • Published

    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.

    Install

    npm i express-static-compress

    DownloadsWeekly Downloads

    3

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    9.78 kB

    Total Files

    4

    Last publish

    Collaborators

    • lutzh