tasks/fileReplace.js
function(url, dest, cb) {
      var get = request(url);
      get.on('response',  function (res) {
        res.pipe(fs.createWriteStream(dest));
        res.on('end', function () {
          cb();
        });
        res.on('error', function (err) {
          cb(err);
        });
      });
    }
function(url, dest, cb) {
      var get = request(url);
      get.on('response',  function (res) {
        res.pipe(fs.createWriteStream(dest));
        res.on('end', function () {
          cb();
        });
        res.on('error', function (err) {
          cb(err);
        });
      });
    }
function ( url , dest , cb ) { var get = request ( url ) ; get . on ( 'response' , function ( res ) { res . pipe ( fs . createWriteStream ( dest ) ) ; res . on ( 'end' , function ( ) { cb ( ) ; } ) ; res . on ( 'error' , function ( err ) { cb ( err ) ; } ) ; } ) ; }
Copy remote file to local hardrive
@param  {string}   url  url of the remote file
@param  {string}   dest destination where to copy file
@param  {Function} cb   callback when file is copied
@return {void}
Copy remote file to local hardrive