- 使用节点
http
模块并发出“ HEAD”请求 - 例如:声明文件大小
test.js
var http = require("http");module.exports = { "Is file avaliable" : function (client) { var request = http.request({ host: "www.google.com", port: 80, path: "/images/srpr/logo11w.png", method: "HEAD" }, function (response) { client .assert.equal(response.headers["content-length"], 14022, 'Same file size'); client.end(); }).on("error", function (err) { console.log(err); client.end(); }).end(); }};


