大家好,我曾试图发送如下回复
exports.zipfile = function(req, res) {
var zip = new require('node-zip')()
zip.file('zipfile.file', 'hello there')
var data = zip.generate({
type : 'string'
})
var archiver = require('archiver');
var fs = require('fs');
var StringStream = require('string-stream');
http.createServer(function(request, response) {
var dl = archiver('zip')
dl.pipe(response)
dl.append(new fs.createReadStream('/qtiexp/routes/zipfile.xml'), {
name : 'YoDog/SubFolder/static.txt'
})
dl.append(new StringStream("Ooh dynamic stuff!"), {
name : 'YoDog/dynamic.txt'
})
dl.finalize(function(err) {
if (err)
res.send(200000)
})
}).listen(13000);
};
但我仍然听到 Eaddrinuse 错误我想将 xml zipfile 作为 res 从 nodejs 发送到前端