[英]nodejs http request compression (without express but with the possibility of renderize files with jade)
How to send compressed gzipped file when requested from client ? 客户端请求时如何发送压缩的压缩文件?
For example I have: 例如,我有:
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);
and how to cache for avoid multiple gzip requests ? 以及如何缓存以避免多个gzip请求?
解决了压缩jade.renderFile()回调返回的html数据
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.