Skip to content

Commit eaf62b9

Browse files
committed
implementing ls -1
1 parent 4aceacf commit eaf62b9

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

implement-shell-tools/ls/ls.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { promises as fs } from "node:fs";
2+
async function listDir() {
3+
const fileListArray = await fs.readdir("./");
4+
//console.log(fileListArray);
5+
const flag = process.argv[2];
6+
const fileNamePattern = process.argv[3];
7+
for(const item of fileListArray){
8+
console.log(item);
9+
}
10+
11+
}
12+
listDir();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}

0 commit comments

Comments
 (0)