A comprehensive collection of Node.js exercises demonstrating the use of built-in modules, specifically readline and fs modules with modern promise-based APIs.
- Files:
index.js(CommonJS),index.mjs(ES6 modules) - Features: Interactive name input with personalized greeting
- Technologies:
readline,process
- Files:
index.js,index-async.js - Features: Basic readline usage and async patterns
- Technologies:
readline,process
- Files:
index.js(CommonJS),index.mjs(ES6 modules) - Features: Password validation with criteria checking
- Technologies:
readline,process - Validation: Minimum length, uppercase, lowercase letters
- Files:
index.mjs - Features: Interactive number guessing with retry mechanism
- Technologies:
readline/promises,process - Game Logic: Random number generation, attempt tracking, input validation
- Files:
index.mjs - Features: Multi-field form with comprehensive validation
- Technologies:
readline/promises,process - Validation: Name, age, email validation with retry mechanism
- Files:
index.js,create.js,sample.txt,output.txt - Features: File reading and writing operations
- Technologies:
fs,path - Operations:
readFile(),writeFile()
- Files:
index.mjs - Features: Directory contents listing with error handling
- Technologies:
fs/promises,path - Operations:
readdir()with async/await
- Files:
index.mjs - Features: Interactive file reading with user input
- Technologies:
readline/promises,fs/promises - Features: User-friendly interface, error handling
- Files:
index.mjs,diary.txt - Features: Complete diary application with timestamps
- Technologies:
readline/promises,fs/promises - Features: Read/Write entries, automatic timestamps, input validation
- ✅ ES6 Modules with
import/export - ✅ Async/Await syntax for clean asynchronous code
- ✅ Promise-based APIs (
fs/promises,readline/promises) - ✅ Error Handling with try/catch blocks
- ✅ Readline Module: Interactive command-line interfaces
- ✅ File System Module: File and directory operations
- ✅ Process Module: Standard input/output handling
- ✅ Path Module: Cross-platform file path handling
- ✅ Input Validation: Comprehensive user input checking
- ✅ Error Handling: Graceful error management
- ✅ User Experience: Clear prompts and feedback
- ✅ Code Organization: Modular function design
- ✅ Resource Management: Proper cleanup of interfaces
- Node.js - Runtime environment
- JavaScript ES6+ - Modern JavaScript features
- CommonJS - Traditional Node.js module system
- ES6 Modules - Modern module system
- Promises - Asynchronous programming
- Async/Await - Clean asynchronous syntax
act-node-built-in-modules/
├── node-readline-1/ # Personalized greeting
├── node-readline-2/ # Interactive input examples
├── node-readline-3/ # Password validation
├── node-readline-4/ # Number guessing game
├── node-readline-5/ # User information collection
├── node-fs-1/ # File operations
├── node-fs-3/ # Directory listing
├── node-fs-4/ # Interactive file reader
├── node-fs-5/ # Digital diary application
└── README.md # This file
After completing these exercises, you will understand:
- Readline Module: How to create interactive command-line applications
- File System Module: How to read, write, and manage files and directories
- Promise-based APIs: Modern asynchronous programming patterns
- Error Handling: Robust error management in Node.js applications
- Input Validation: Ensuring data integrity in user applications
- Module Systems: Both CommonJS and ES6 module patterns
Each project can be run independently:
# Navigate to any project folder
cd node-readline-1
# Run CommonJS version
node index.js
# Run ES6 modules version (if available)
node index.mjs
# Or use npm scripts
npm start- All projects include comprehensive error handling
- Input validation is implemented where appropriate
- Both CommonJS and ES6 module patterns are demonstrated
- Modern promise-based APIs are used throughout
- User-friendly interfaces with clear feedback
This is a learning project demonstrating Node.js built-in modules. Feel free to explore the code and experiment with modifications!
Created as part of Node.js learning journey 🚀