function(from, to) {
      return new Promise((resolve, reject) => {
        util.mkParentPath(to, function() {
          var rs = fs.createReadStream(from, { flags: "r", encoding: "binary" });
          var ws = fs.createWriteStream(to, { flags: "w", encoding: "binary" });
          rs.on("end", function() {
            resolve();
          });
          rs.on("error", reject);
          ws.on("error", reject);
          rs.pipe(ws);
        });
      });
    }
function(from, to) {
      return new Promise((resolve, reject) => {
        util.mkParentPath(to, function() {
          var rs = fs.createReadStream(from, { flags: "r", encoding: "binary" });
          var ws = fs.createWriteStream(to, { flags: "w", encoding: "binary" });
          rs.on("end", function() {
            resolve();
          });
          rs.on("error", reject);
          ws.on("error", reject);
          rs.pipe(ws);
        });
      });
    }
function ( from , to ) { return new Promise ( ( resolve , reject ) => { util . mkParentPath ( to , function ( ) { var rs = fs . createReadStream ( from , { flags : "r" , encoding : "binary" } ) ; var ws = fs . createWriteStream ( to , { flags : "w" , encoding : "binary" } ) ; rs . on ( "end" , function ( ) { resolve ( ) ; } ) ; rs . on ( "error" , reject ) ; ws . on ( "error" , reject ) ; rs . pipe ( ws ) ; } ) ; } ) ; }
Copies a file
@param from {String} path to copy from
@param to {String} path to copy to
@param cb(err) {Function}
@async
Copies a file