Folder Info
Inspect a folder and print its file and folder counts.
5 upvotes
10 upvotes
Folder Info
You are required to build a CLI tool using Node.js that prints information about a folder.
The tool should inspect the current folder by default. If the user passes a folder path, it should inspect that folder instead.
Here are some example commands you can run to test your CLI:
On successful execution, the output should look like this:
Files is the number of files in the folder, and Folders is the number of subfolders.
If the folder cannot be read, print a friendly error:
The error should go to stderr, and the command should set a non-zero exit code.
The goal of this project is to practice reading the current folder, accepting an optional path, and using Node.js to inspect folder contents.
You will need these Node.js APIs:
process.cwd()to get the folder where the command started.node:pathto resolve a folder path and get the folder name.node:fs/promisesto read the folder contents.
Solution
Solution:
