How to download and unzip a zip file in memory in NodeJs?

后端 未结 4 961
终归单人心
终归单人心 2020-11-28 22:44

I want to download a zip file from the internet and unzip it in memory without saving to a temporary file. How can I do this?

Here is what I tried:

v         


        
4条回答
  •  清酒与你
    2020-11-28 23:07

    Two days ago the module node-zip has been released, which is a wrapper for the JavaScript only version of Zip: JSZip.

    var NodeZip = require('node-zip')
      , zip = new NodeZip(zipBuffer.toString("base64"), { base64: true })
      , unzipped = zip.files["your-text-file.txt"].data;
    

提交回复
热议问题