
Week 11: Node.js Fundamentals and Understanding Core Modules
Node.js Fundamentals Week 11 covered Node.js core modules and finished the weather CLI from last week. Core Modules File System Module The fs module handles all file operations. Reading files, writing data, checking existence, creating directories, and getting file stats. Using fs/promises makes everything work with async/await. Clean async code without callbacks. Error handling is critical. File operations fail often. Files don't exist, permissions are incorrect, and the disk is full. Every operation needs try/catch. Path Module The path module handles file paths correctly across operating systems. Windows uses backslashes, Unix uses forward slashes. Path handles this automatically. Join builds paths correctly. Resolve gets absolute paths. Dirname, basename, and extname extract path components. Events Module EventEmitter is how Node.js handles events internally. You create events, listen for them, and emit them when things happen. This pattern appears everywhere in Node.js. Streams us
Continue reading on Dev.to JavaScript
Opens in a new tab



