packages/cli/src/tools/copyFiles.js
function copyBinaryFile(srcPath, destPath, cb) {
  let cbCalled = false;
  // const {mode} = fs.statSync(srcPath);
  const readStream = fs.createReadStream(srcPath);
  const writeStream = fs.createWriteStream(destPath);
  readStream.on('error', err => {
    done(err);
  });
  writeStream.on('error', err => {
    done(err);
  });
  readStream.on('close', () => {
    done();
    // We may revisit setting mode to original later, however this fn is used
    // before "replace placeholder in template" step, which expects files to be
    // writable.
    // fs.chmodSync(destPath, mode);
  });
  readStream.pipe(writeStream);
  function done(err) {
    if (!cbCalled) {
      cb(err);
      cbCalled = true;
    }
  }
}
function copyBinaryFile(srcPath, destPath, cb) {
  let cbCalled = false;
  // const {mode} = fs.statSync(srcPath);
  const readStream = fs.createReadStream(srcPath);
  const writeStream = fs.createWriteStream(destPath);
  readStream.on('error', err => {
    done(err);
  });
  writeStream.on('error', err => {
    done(err);
  });
  readStream.on('close', () => {
    done();
    // We may revisit setting mode to original later, however this fn is used
    // before "replace placeholder in template" step, which expects files to be
    // writable.
    // fs.chmodSync(destPath, mode);
  });
  readStream.pipe(writeStream);
  function done(err) {
    if (!cbCalled) {
      cb(err);
      cbCalled = true;
    }
  }
}
function copyBinaryFile ( srcPath , destPath , cb ) { let cbCalled = false ; // const {mode} = fs.statSync(srcPath); const readStream = fs . createReadStream ( srcPath ) ; const writeStream = fs . createWriteStream ( destPath ) ; readStream . on ( 'error' , err => { done ( err ) ; } ) ; writeStream . on ( 'error' , err => { done ( err ) ; } ) ; readStream . on ( 'close' , ( ) => { done ( ) ; // We may revisit setting mode to original later, however this fn is used // before "replace placeholder in template" step, which expects files to be // writable. // fs.chmodSync(destPath, mode); } ) ; readStream . pipe ( writeStream ) ; function done ( err ) { if ( ! cbCalled ) { cb ( err ) ; cbCalled = true ; } } }
Same as 'cp' on Unix. Don't do any replacements.
Same as cp on Unix . Don t do any replacements .