# Node

# module

module.exports = boboLog

# Node ES6 特性支持

特性支持进度 node.green (opens new window)

node --v8-options | grep "in progress"

# 文件下载

var fs = require('fs'),
    request = require('request');

var download = function(uri, filename, callback){
  request.head(uri, function(err, res, body){
    console.log('content-type:', res.headers['content-type']);
    console.log('content-length:', res.headers['content-length']);

    request(uri).pipe(fs.createWriteStream(filename)).on('close', callback);
  });
};

download('https://www.google.com/images/srpr/logo3w.png', 'google.png', function(){
  console.log('done');
});
Last Updated: 5/14/2022, 11:38:45 AM