From db929233f89cbb88c2580b63c7c4d57e42f4a8e2 Mon Sep 17 00:00:00 2001 From: Jongil Seok Date: Sat, 18 Feb 2017 13:20:09 +0900 Subject: [PATCH] my suggestion Honestly, I didn't test this code. :-) --- lesson3/challenges/copyFile.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lesson3/challenges/copyFile.js b/lesson3/challenges/copyFile.js index c111689..d7268bd 100644 --- a/lesson3/challenges/copyFile.js +++ b/lesson3/challenges/copyFile.js @@ -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); +});