Skip to content

Commit

Permalink
Added ls command
Browse files Browse the repository at this point in the history
  • Loading branch information
hemanth-hk committed Mar 31, 2020
1 parent d7eac80 commit 5a60826
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions commands/ls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//imports
const fs = require('fs');

// function which returns the array of all the directories

function ls(path) {
fs.readdir(path, (err, files) => {
files.forEach(file => {
console.log(`${file}`)
});
});
}

// export the function
module.exports = ls;

0 comments on commit 5a60826

Please sign in to comment.