lib/base.js
function copyBase(src, dest, options, callback) {
  if (typeof options !== 'object') {
    callback = options;
    options = {};
  }

  if (arguments.length < 3) {
    return invalid.apply(null, arguments);
  }

  var fs = utils.fs; // graceful-fs (lazyily required)
  var opts = utils.extend({overwrite: true}, options);
  var cb = once(callback);
  var listener = once(ws);
  src = path.resolve(src);

  var rs = fs.createReadStream(src)
    .on('error', handleError('read', src, opts, cb))
    .once('readable', listener)
    .on('end', listener);

  function ws() {
    mkdir(dest, function(err) {
      if (err) return cb(err);
      rs.pipe(fs.createWriteStream(dest, writeOpts(opts))
        .on('error', handleError('write', dest, opts, cb))
        .on('close', handleClose(src, dest, cb)));
    });
  }
}
function copyBase(src, dest, options, callback) {
  if (typeof options !== 'object') {
    callback = options;
    options = {};
  }

  if (arguments.length < 3) {
    return invalid.apply(null, arguments);
  }

  var fs = utils.fs; // graceful-fs (lazyily required)
  var opts = utils.extend({overwrite: true}, options);
  var cb = once(callback);
  var listener = once(ws);
  src = path.resolve(src);

  var rs = fs.createReadStream(src)
    .on('error', handleError('read', src, opts, cb))
    .once('readable', listener)
    .on('end', listener);

  function ws() {
    mkdir(dest, function(err) {
      if (err) return cb(err);
      rs.pipe(fs.createWriteStream(dest, writeOpts(opts))
        .on('error', handleError('write', dest, opts, cb))
        .on('close', handleClose(src, dest, cb)));
    });
  }
}
function copyBase ( src , dest , options , callback ) { if ( typeof options !== 'object' ) { callback = options ; options = { } ; } if ( arguments . length < 3 ) { return invalid . apply ( null , arguments ) ; } var fs = utils . fs ; // graceful-fs (lazyily required) var opts = utils . extend ( { overwrite : true } , options ) ; var cb = once ( callback ) ; var listener = once ( ws ) ; src = path . resolve ( src ) ; var rs = fs . createReadStream ( src ) . on ( 'error' , handleError ( 'read' , src , opts , cb ) ) . once ( 'readable' , listener ) . on ( 'end' , listener ) ; function ws ( ) { mkdir ( dest , function ( err ) { if ( err ) return cb ( err ) ; rs . pipe ( fs . createWriteStream ( dest , writeOpts ( opts ) ) . on ( 'error' , handleError ( 'write' , dest , opts , cb ) ) . on ( 'close' , handleClose ( src , dest , cb ) ) ) ; } ) ; } }
Copy a file from `src` to `dest`

@param {String} `src` Source filepath
@param {String} `dest` Destination filepath
@param {Object} `options`
@param {Function} `cb` Callback function
@api public
Copy a file from src to dest