From a20a893ca7f21bbe2b4a8dddf70387627be23a7c Mon Sep 17 00:00:00 2001 From: Davide Morra Date: Fri, 19 Jan 2024 11:43:29 +0100 Subject: [PATCH] Update writing-files-with-nodejs.md Minor changes to reflect purpose of examples Signed-off-by: Davide Morra --- .../learn/manipulating-files/writing-files-with-nodejs.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pages/en/learn/manipulating-files/writing-files-with-nodejs.md b/pages/en/learn/manipulating-files/writing-files-with-nodejs.md index 429ca17e20510..c9936897c6dba 100644 --- a/pages/en/learn/manipulating-files/writing-files-with-nodejs.md +++ b/pages/en/learn/manipulating-files/writing-files-with-nodejs.md @@ -18,8 +18,9 @@ const content = 'Some content!'; fs.writeFile('/Users/joe/test.txt', content, err => { if (err) { console.error(err); + } else { + // file written successfully } - // file written successfully }); ``` @@ -53,6 +54,7 @@ async function example() { console.log(err); } } + example(); ``` @@ -91,8 +93,9 @@ const content = 'Some content!'; fs.appendFile('file.log', content, err => { if (err) { console.error(err); + } else { + // done! } - // done! }); ``` @@ -111,5 +114,6 @@ async function example() { console.log(err); } } + example(); ```