Error: incorrect header check when running post

我只是一个虾纸丫 提交于 2019-12-01 11:11:40

zlib is meant to extract gzipped or deflated data, not .ZIP files.

You can use the node-unzip module for those:

var unzip = require('unzip');
...
app.post('/', function(req, res) {
  var extractor = unzip.Extract({ path : 'C://myFolder' }).on('close', function() {
    res.sendStatus(200);
  }).on('error', function(err) {
    res.sendStatus(500);
  });
  req.pipe(extractor);
});

If Postman can't handle uploads like this (as suggested in the comments), you can test using cURL:

$ curl -XPOST localhost:3000 --data-binary @test.zip
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!