Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lesson3/challenges/copyFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
var fs = require('fs');

// 1. Do this synchronously first
const contents = fs.readFileSync('hello.html');
fs.writeFileSync('hello-copy.html', contents);

// 2. Do the same thing asynchronously
fs.readFile('hello.html', (contents) => {
fs.writeFile('hello-copy.html', contents);
});