Inspect a folder and print its file and folder counts.
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:path to resolve a folder path and get the folder name.
node:fs/promises to read the folder contents.
Join the Community
roadmap.sh is the most starred project on GitHub and is visited by hundreds of thousands of developers every month.
Roadmaps Best Practices Guides Videos FAQs YouTube
roadmap.sh by @kamrify @kamrify
Community created roadmaps, best practices, projects, articles, resources and journeys to help you choose your path and grow in your career.
Login or Signup
You must be logged in to perform this action.