【问题标题】:nodejs http request compression (without express but with the possibility of renderize files with jade)nodejs http请求压缩(没有express,但可以用jade渲染文件)
【发布时间】: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


    【解决方案1】:

    解决了jade.renderFile()回调返回的压缩html数据问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-29
      • 1970-01-01
      • 2013-12-28
      • 1970-01-01
      • 1970-01-01
      • 2014-06-01
      • 1970-01-01
      相关资源
      最近更新 更多