1. const fs = require('fs');
  2. // File destination.txt will be created or overwritten by default.
  3. fs.copyFile('source.txt', 'destination.txt', (err) => {
  4. if (err) throw err;
  5. console.log('source.txt was copied to destination.txt');
  6. });