Node.js Cheat Sheet

Core Node.js modules, NPM commands, and Express basics.

NPM Basics

Concept / Tag Code Snippet Description
Init Project
npm init -y
Start new node project.
Install Pkg
npm install name --save
Add dependency.
Run Script
npm run script-name
Execute package.json scripts.

File System

Concept / Tag Code Snippet Description
Read File
fs.readFile("path", "utf8", callback);
Asynchronous file reading.
Write File
fs.writeFileSync(path, data);
Synchronous file writing.

OS Module

Concept / Tag Code Snippet Description
Memory Info
os.totalmem() | os.freemem()
Check system memory.

Explore More Cheat Sheets