【发布时间】:2014-01-30 15:42:18
【问题描述】:
如何在客户端请求时发送压缩的 gzip 文件?
例如我有:
var zlib = require("zlib"),
http = require("http");
http.createServer(function(req, res) {
/*req.url is the url of the file requested
how to compress and send the file here?
consider that usually (facoltative) I can renderize the file also with Jade.renderFile()
so the best solution is to compress the output before sending to client */
}).listen(80);
以及如何缓存以避免多个 gzip 请求?
【问题讨论】:
标签: javascript node.js http gzip zlib