index.js
function copyOne(file, dir, options, cb) {
  if (arguments.length < 3) {
    return invalid.apply(null, arguments);
  }

  if (typeof options === 'function') {
    cb = options;
    options = {};
  }

  var opts = utils.extend({}, options);
  if (typeof opts.cwd === 'undefined') {
    opts.cwd = process.cwd();
  }
  if (typeof file === 'string') {
    file = path.resolve(opts.cwd, file);
  }

  if (!opts.srcBase && opts.patterns) {
    opts.srcBase = path.resolve(opts.cwd, utils.parent(opts.patterns));
  }

  toDest(dir, file, opts, function(err, out) {
    if (err) {
      cb(err);
      return;
    }

    base(file, out.path, opts, function(err) {
      if (err) {
        cb(err);
        return;
      }

      cb(null, out);
    });
  });
}
function copyOne(file, dir, options, cb) {
  if (arguments.length < 3) {
    return invalid.apply(null, arguments);
  }

  if (typeof options === 'function') {
    cb = options;
    options = {};
  }

  var opts = utils.extend({}, options);
  if (typeof opts.cwd === 'undefined') {
    opts.cwd = process.cwd();
  }
  if (typeof file === 'string') {
    file = path.resolve(opts.cwd, file);
  }

  if (!opts.srcBase && opts.patterns) {
    opts.srcBase = path.resolve(opts.cwd, utils.parent(opts.patterns));
  }

  toDest(dir, file, opts, function(err, out) {
    if (err) {
      cb(err);
      return;
    }

    base(file, out.path, opts, function(err) {
      if (err) {
        cb(err);
        return;
      }

      cb(null, out);
    });
  });
}
function copyOne ( file , dir , options , cb ) { if ( arguments . length < 3 ) { return invalid . apply ( null , arguments ) ; } if ( typeof options === 'function' ) { cb = options ; options = { } ; } var opts = utils . extend ( { } , options ) ; if ( typeof opts . cwd === 'undefined' ) { opts . cwd = process . cwd ( ) ; } if ( typeof file === 'string' ) { file = path . resolve ( opts . cwd , file ) ; } if ( ! opts . srcBase && opts . patterns ) { opts . srcBase = path . resolve ( opts . cwd , utils . parent ( opts . patterns ) ) ; } toDest ( dir , file , opts , function ( err , out ) { if ( err ) { cb ( err ) ; return ; } base ( file , out . path , opts , function ( err ) { if ( err ) { cb ( err ) ; return ; } cb ( null , out ) ; } ) ; } ) ; }
Copy a single `file` to the given `dest` directory, using
the specified options and callback function.

```js
copy.one('foo.txt', 'dist', function(err, file) {
if (err) throw err;
// exposes the vinyl `file` that is created when the file is copied
});
```
@name .copy.one
@param {String|Object} `file` Filepath or vinyl file
@param {String} `dir` Destination directory
@param {Object|Function} `options` or callback function
@param {Function} `cb` Callback function if no options are specified
@api public
Copy a single file to the given dest directory using the specified options and callback function .