Skip to content

Commit 72f049e

Browse files
committed
Add two examples to fs_demo
1 parent 1dc08d8 commit 72f049e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

reference/fs_demo.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,15 @@ fs.rmdir(path.join(__dirname, "/myFolderToDelete"), (err) => {
106106
});
107107

108108

109-
109+
// Read the contents of a folder
110+
// NOTE: the first argument can be whatever route you want, it doesn't have to be the actual dirname.
111+
fs.readdir(__dirname, (err, files) => {
112+
if (err) throw err
113+
console.log(files)
114+
})
115+
116+
// Copy a file
117+
fs.copyFile('source.txt', 'destination.txt', err => {
118+
if (err) throw err;
119+
console.log('File copied...')
120+
})

0 commit comments

Comments
 (0)