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.
Be aware that, unlike
server-staticthis package does not support response with Content-Range header yet, I am working on it!
$ npm install serve-static-zipTypescript
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();