Node.js库解析类似HTTP协议的工具

Node.js库httplike用于解析类似HTTP协议的内容。安装使用npm install httplike,然后可以通过以下方式使用:javascript var Parser = require('httplike'); var p = new Parser(socket); p.on('message', function(msg) { console.log(msg.method); console.log(msg.headers); console.log(msg.content); });httplike假设传入协议符合HTTP标准,使用Content-Length标头确定响应正文字节数。更新日志:修复了与UTF-8字符和流水线请求相关的问题。

zip 文件大小:8.87KB