您的位置:首页 > Web前端 > Node.js

How to download a file with Node.js?

2015-07-15 15:21 666 查看
http://stackoverflow.com/questions/11944932/how-to-download-a-file-with-node-js

var http = require('http');
var fs = require('fs');

var file = fs.createWriteStream("file.jpg");
var request = http.get("http://i3.ytimg.com/vi/J---aiyznGQ/mqdefault.jpg", function(response) {
response.pipe(file);
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: