JSON Zip Response in node.js

前端 未结 3 615
一向
一向 2021-02-04 18:04

I\'m pretty new to node.js and I\'m trying to send back a zip file containing JSON results. I\'ve been trying to figure it out how to do it, but haven\'t had the expected result

3条回答
  •  一生所求
    2021-02-04 18:28

    For Express 4+, compress does not come bundled with Express and needs to be installed separately.

    $ npm install compression
    

    Then to use the library:

    var compression = require('compression');
    app.use(compression());
    

    There are a bunch of options you can tune, see here for the list.

提交回复
热议问题