serve-static-zip

Serve static files

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
serve-static-zip
201.0.35 years ago5 years agoMinified + gzip package size for serve-static-zip in KB

Readme

serve-static-zip

Install

This is a Node.js module available through the npm registry. Installation is done using the npm install command:
Consider comparing to use serve-static in express appliaction, this package is for serving static resource file from a zip file buffer in memory, while serve-static serves static resource files from a local directory.
$ npm install serve-static-zip

API

Typescript
import createServeZip = require('serve-static-zip');
import {Response} from 'express';

const serveZip = createServeZip({
  maxAage: 0,
  setHeaders: (res: Response, path: string, entry: Entry) => {
  }
  // ...
  // same options as serve-static has
});
expressApp.use('/', serveZip.handler);

// later some time, you can update resource with new zip buffer
// The file comes from new zip buffer will overwrite the old one which has same path
serveZip.updateZip(zipFileBuffer);

// To clean up old files in memory
serveZip.cache.clear();

License

MIT