Created
July 13, 2020 14:13
-
-
Save premkash/afd85e70d3f969a088d71ac676c624b5 to your computer and use it in GitHub Desktop.
Displays the info about files in a directory at a given path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fsp = require("fs/promises"); | |
async function dirFilesInfo(path) { | |
const dir = await fsp.opendir(path); | |
for await (const dirEntry of dir) { | |
const fileInfo = await fsp.stat("./" + dirEntry.name); | |
console.log(dirEntry.name, fileInfo); | |
} | |
} | |
dirFilesInfo("./").catch(console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment