code: function _copy(src, dst, options) {
    options = _.opts(options, {exclude: [], owner: {}});
    if (matches(src, options.exclude)) return;
    const sstat = fs.lstatSync(src);
    let dstat;
    let sstatType = sstat.mode & 61440;
    let sstatMode = sstat.mode & 4095;
  
    if (exists(dst) && isDirectory(dst, {acceptLinks: false})) {
      dst = path.join(dst, path.basename(src));
    }
  
    if (exists(dst)) {
      dstat = fs.lstatSync(dst);
      sstatType = sstat.mode & 61440;
      const dstatType = dstat.mode & 61440;
      sstatMode = sstat.mode & 4095;
  
      if (sstatType !== dstatType) {
        throw new Error(`Types of '${src}' and '${dst}' differ`);
      }
    }
    const parent = path.dirname(dst);
    if (!exists(parent)) {
      mkdir(parent);
    } else if (!isDirectory(parent)) {
      throw new Error(`Cannot copy ${src} to non-directory ${parent}`);
    }
    if (sstat.isDirectory()) {
      _copyDirectory(src, dst, options);
      fs.chmodSync(dst, sstatMode);
    } else if (sstat.isSymbolicLink()) {
      if (dstat) {
        fs.unlinkSync(dst);
      }
      link(fs.readlinkSync(src), dst, {force: true});
    } else {
      // TODO: improve for long files
      fs.copySync(src, dst);
      fs.chmodSync(dst, sstatMode);
      if (!_.isEmpty(options.owner)) {
        chown(dst, options.owner, {abortOnError: false});
      }
    }
  }
docs: /* eslint-disable no-use-before-define