{"id":1453,"date":"2025-05-29T10:45:40","date_gmt":"2025-05-29T10:45:40","guid":{"rendered":"https:\/\/www.wordpress-prod.sharpener.tech\/?p=1453"},"modified":"2025-05-29T11:33:22","modified_gmt":"2025-05-29T11:33:22","slug":"understanding-core-modules-in-node-js","status":"publish","type":"post","link":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/","title":{"rendered":"\u00a0Understanding Core Modules in Node.js"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/www.wordpress-prod.sharpener.tech\/wp-content\/uploads\/2025\/05\/ChatGPT-Image-May-29-2025-04_13_20-PM-1024x683.jpg\" alt=\"\" class=\"wp-image-1454\" srcset=\"https:\/\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\/blog\/wp-content\/uploads\/2025\/05\/29104439\/ChatGPT-Image-May-29-2025-04_13_20-PM-1024x683.jpg 1024w, https:\/\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\/blog\/wp-content\/uploads\/2025\/05\/29104439\/ChatGPT-Image-May-29-2025-04_13_20-PM-300x200.jpg 300w, https:\/\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\/blog\/wp-content\/uploads\/2025\/05\/29104439\/ChatGPT-Image-May-29-2025-04_13_20-PM-768x512.jpg 768w, https:\/\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\/blog\/wp-content\/uploads\/2025\/05\/29104439\/ChatGPT-Image-May-29-2025-04_13_20-PM.jpg 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hey everyone! Welcome back. Today, we\u2019re diving into something every Node.js developer needs to understand \u2013 <strong>Core Modules in Node.js<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What are Core Modules?<br>Why do we need them?<br>How do they help us build better applications?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this video, I\u2019ll answer these questions with real examples and code demos. Let&#8217;s get started!&#8221;*<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What\u2019s the Problem?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Imagine you&#8217;re building a backend system. You need to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Handle files<br><\/li>\n\n\n\n<li>Create a web server<br><\/li>\n\n\n\n<li>Work with file paths<br><\/li>\n\n\n\n<li>Get system information<br><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You start installing external libraries, and before you know it, your project is bloated. Some libraries might be outdated, have security vulnerabilities, or be unnecessary for your needs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is exactly why Node.js provides Core Modules. Core Modules are <strong>pre-installed<\/strong>, optimized, and built into Node.js, so you don\u2019t need to install anything extra. They\u2019re fast, secure, and efficient.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let\u2019s break them down one by one.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>File System (fs) Module \u2013 Reading &amp; Writing Files<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s start with the <strong>fs module<\/strong> \u2013 the File System module. It allows us to read, write, and modify files in Node.js.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, let\u2019s say we have a file called <strong>&#8216;data.txt&#8217;<\/strong>, and we want to read its content.&#8221;*<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example: Reading a File<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">const fs = require(&#8216;fs&#8217;);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">fs.readFile(&#8216;data.txt&#8217;, &#8216;utf8&#8217;, (err, data) =&gt; {<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;if (err) {<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.error(&#8216;Error reading file:&#8217;, err);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;console.log(&#8216;File content:&#8217;, data);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">});<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Here, <\/em><em>fs.readFile<\/em><em> reads the file asynchronously. If there&#8217;s an error, it prints it. Otherwise, it logs the file content.&#8221;<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example: Writing to a File<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">fs.writeFile(&#8216;output.txt&#8217;, &#8216;Hello, Node.js!&#8217;, (err) =&gt; {<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;if (err) throw err;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;console.log(&#8216;File written successfully!&#8217;);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">});<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>&#8220;This writes &#8216;Hello, Node.js!&#8217; into <\/em><strong><em>output.txt<\/em><\/strong><em>. Simple and efficient!&#8221;<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>HTTP Module \u2013 Creating a Web Server<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;A simple request-response diagram<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">*&#8221;Next, we have the <strong>http module<\/strong>, which allows us to create web servers in just a few lines of code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s say we want to create a basic server that sends a response when someone visits our site.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example: Creating a Simple Web Server<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">const http = require(&#8216;http&#8217;);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">const server = http.createServer((req, res) =&gt; {<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;res.writeHead(200, { &#8216;Content-Type&#8217;: &#8216;text\/plain&#8217; });<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;res.end(&#8216;Hello from Node.js Server!&#8217;);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">});<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">server.listen(3000, () =&gt; {<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;console.log(&#8216;Server running at http:\/\/localhost:3000\/&#8217;);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">});<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>&#8220;This creates a basic <\/em><strong><em>server<\/em><\/strong><em> running on <\/em><strong><em>port 3000<\/em><\/strong><em>. You can open your browser and visit <\/em><strong><em>http:\/\/localhost:3000<\/em><\/strong><em> to see the response.&#8221;<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Path Module \u2013 Managing File Paths<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When working with files, you often need to deal with <strong>file paths<\/strong>. The path module helps manage these efficiently.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, let\u2019s extract some information from a file path.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example: Working with File Paths<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">CopyEdit<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">const path = require(&#8216;path&#8217;);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">const filePath = &#8216;\/users\/docs\/file.txt&#8217;;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">console.log(&#8216;Directory:&#8217;, path.dirname(filePath));<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">console.log(&#8216;File Name:&#8217;, path.basename(filePath));<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">console.log(&#8216;Extension:&#8217;, path.extname(filePath));<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>&#8220;Now you know exactly where your files are and how to work with them.&#8221;<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>OS Module \u2013 System Information<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">CPU &amp; Memory details<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>What if you need to check <\/em><strong><em>system information<\/em><\/strong><em> like CPU, memory, or platform? The <\/em><em>os<\/em><em> module has you covered.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>This is useful when building applications that need to monitor system performance and you want to make some modification based on that.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example: Fetching System Info<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">js<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">CopyEdit<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">const os = require(&#8216;os&#8217;);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">console.log(&#8216;Platform:&#8217;, os.platform());<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">console.log(&#8216;Total Memory:&#8217;, os.totalmem());<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">console.log(&#8216;Free Memory:&#8217;, os.freemem());<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">console.log(&#8216;CPU Info:&#8217;, os.cpus());<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Visual: Console displaying system info<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>&#8220;This is useful when building applications that need to monitor system performance.&#8221;<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Events Module \u2013 Handling Events<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><em>&#8220;Node.js is <\/em><strong><em>event-driven<\/em><\/strong><em>, meaning it reacts to things happening, like user clicks, data arriving, or errors occurring. The <\/em><em>events<\/em><em> module lets us handle custom events.&#8221;<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example: Creating an Event<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">const EventEmitter = require(&#8216;events&#8217;);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">const eventEmitter = new EventEmitter();<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">eventEmitter.on(&#8216;greet&#8217;, () =&gt; {<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;console.log(&#8216;Hello, Welcome to Node.js!&#8217;);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">});<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">eventEmitter.emit(&#8216;greet&#8217;);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>This is useful for handling user actions, server responses, and more!<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Summary &amp; Call to Action<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">*&#8221;So, we covered the most important Core Modules in Node.js:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>fs \u2013 File handling<br><\/li>\n\n\n\n<li>http \u2013 Web servers<br><\/li>\n\n\n\n<li>path \u2013 File paths<br><\/li>\n\n\n\n<li>os \u2013 System info<br><\/li>\n\n\n\n<li>events \u2013 Event handling<br><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Now it\u2019s your turn! Try using these modules in a real project. If you found this helpful<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2014&#8212;-<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Without codes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>What are Core Modules?<\/li>\n\n\n\n<li>Why do we need them?<\/li>\n\n\n\n<li>How do they help us build better applications?<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">By the end of this video, you&#8217;ll have a clear idea of why Core Modules are essential and how they simplify backend development. We will also explore <strong>Local Modules<\/strong>, which are custom modules that we create and import within our projects. And don\u2019t worry\u2014we\u2019ll learn to implement everything step by step as we progress in this course. Let\u2019s get started!&#8221;<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What\u2019s the Problem?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Imagine you&#8217;re building a backend system. You need to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Handle files<\/li>\n\n\n\n<li>Create a web server<\/li>\n\n\n\n<li>Work with file paths<\/li>\n\n\n\n<li>Get system information<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You might think about installing external libraries for each of these tasks. But before you know it, your project is bloated with dependencies. Some might be outdated, introduce security vulnerabilities, or be unnecessary for your needs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is exactly why Node.js provides <strong>Core Modules<\/strong> \u2013 built-in, optimized, and ready to use. They are:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2705 Fast<br>\u2705 Secure<br>\u2705 Efficient<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">No need for extra installations \u2013 they are available right out of the box. Let\u2019s explore them!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>File System (fs) Module \u2013 Working with Files<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">One of the most common backend tasks is handling files \u2013 reading, writing, and modifying them. The <strong>fs module<\/strong> makes this easy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Think about a situation where you need to store user data in a file or retrieve configuration settings. The <strong>fs module<\/strong> provides methods to interact with the file system efficiently.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udca1 <em>Example use cases:<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Reading configuration files<\/li>\n\n\n\n<li>Logging system activity<\/li>\n\n\n\n<li>Storing user-generated content<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>HTTP Module \u2013 Creating a Web Server<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A backend isn\u2019t complete without a way to communicate with users. The <strong>http module<\/strong> allows us to create web servers effortlessly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Imagine someone visits your website. The server needs to:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Listen for incoming requests.<\/li>\n\n\n\n<li>Process the request.<\/li>\n\n\n\n<li>Send an appropriate response.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>http module<\/strong> helps with all of this in just a few lines of code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udca1 <em>Example use cases:<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Serving web pages dynamically<\/li>\n\n\n\n<li>Building REST APIs<\/li>\n\n\n\n<li>Handling form submissions<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Path Module \u2013 Managing File Paths<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When working with files, handling paths efficiently is crucial. Different operating systems use different path formats (Windows vs. Linux). The <strong>path module<\/strong> standardizes this.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, if you need to extract file details like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The directory name<\/li>\n\n\n\n<li>The file name<\/li>\n\n\n\n<li>The file extension<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>path module<\/strong> makes it seamless!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udca1 <em>Example use cases:<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Constructing dynamic file paths<\/li>\n\n\n\n<li>Organizing project directories<\/li>\n\n\n\n<li>Handling file uploads<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>OS Module \u2013 Getting System Information<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Sometimes, applications need to adapt based on system resources. The <strong>os module<\/strong> helps fetch system-related data like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>CPU details<\/li>\n\n\n\n<li>Memory usage<\/li>\n\n\n\n<li>Platform information<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This is especially useful for optimizing performance and system monitoring.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udca1 <em>Example use cases:<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Checking system health before launching an app<\/li>\n\n\n\n<li>Gathering analytics on resource usage<\/li>\n\n\n\n<li>Making dynamic optimizations<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Events Module \u2013 Handling Events<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Node.js is <strong>event-driven<\/strong>, meaning it reacts to actions like user clicks, data arrivals, or errors. The <strong>events module<\/strong> allows us to define and handle such events.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Think of it as setting up a notification system. When something happens, you can trigger a specific action.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udca1 <em>Example use cases:<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Handling user interactions (like button clicks)<\/li>\n\n\n\n<li>Managing real-time data (like chat applications)<\/li>\n\n\n\n<li>Logging server activities<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Local Modules \u2013 Custom Modules for Our Projects<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Apart from built-in core modules, <strong>we can also create our own custom modules<\/strong>, known as Local Modules. These allow us to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Structure our code better<\/li>\n\n\n\n<li>Reuse functionalities across different files<\/li>\n\n\n\n<li>Keep our application organized<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For example, we could create a module for handling database connections or processing user authentication.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udca1 <em>Example use cases:<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Creating a custom logging module<\/li>\n\n\n\n<li>Reusing functions in different parts of the app<\/li>\n\n\n\n<li>Organizing business logic<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Summary &amp; Call to Action<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&#8220;So, we covered the most important Core Modules in Node.js:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>fs<\/strong> \u2013 File handling<\/li>\n\n\n\n<li><strong>http<\/strong> \u2013 Web servers<\/li>\n\n\n\n<li><strong>path<\/strong> \u2013 File paths<\/li>\n\n\n\n<li><strong>os<\/strong> \u2013 System info<\/li>\n\n\n\n<li><strong>events<\/strong> \u2013 Event handling<\/li>\n\n\n\n<li><strong>Local Modules<\/strong> \u2013 Custom modules we create<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey everyone! Welcome back. Today, we\u2019re diving into something every Node.js developer needs to understand \u2013 Core Modules in Node.js. What are Core Modules?Why do we need them?How do they&hellip;<\/p>\n","protected":false},"author":6,"featured_media":1454,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-1453","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u00a0Understanding Core Modules in Node.js - Sharpener Tech<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u00a0Understanding Core Modules in Node.js - Sharpener Tech\" \/>\n<meta property=\"og:description\" content=\"Hey everyone! Welcome back. Today, we\u2019re diving into something every Node.js developer needs to understand \u2013 Core Modules in Node.js. What are Core Modules?Why do we need them?How do they&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/\" \/>\n<meta property=\"og:site_name\" content=\"Sharpener Tech\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-29T10:45:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-29T11:33:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\/blog\/wp-content\/uploads\/2025\/05\/29104439\/ChatGPT-Image-May-29-2025-04_13_20-PM.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1536\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Julian Toppo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Julian Toppo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/\"},\"author\":{\"name\":\"Julian Toppo\",\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/#\\\/schema\\\/person\\\/eb9482df421e52d30f961eae8a0fd67a\"},\"headline\":\"\u00a0Understanding Core Modules in Node.js\",\"datePublished\":\"2025-05-29T10:45:40+00:00\",\"dateModified\":\"2025-05-29T11:33:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/\"},\"wordCount\":1390,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/29104439\\\/ChatGPT-Image-May-29-2025-04_13_20-PM.jpg\",\"articleSection\":[\"Tips\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/\",\"url\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/\",\"name\":\"\u00a0Understanding Core Modules in Node.js - Sharpener Tech\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/29104439\\\/ChatGPT-Image-May-29-2025-04_13_20-PM.jpg\",\"datePublished\":\"2025-05-29T10:45:40+00:00\",\"dateModified\":\"2025-05-29T11:33:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/#primaryimage\",\"url\":\"https:\\\/\\\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/29104439\\\/ChatGPT-Image-May-29-2025-04_13_20-PM.jpg\",\"contentUrl\":\"https:\\\/\\\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/29104439\\\/ChatGPT-Image-May-29-2025-04_13_20-PM.jpg\",\"width\":1536,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/understanding-core-modules-in-node-js\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u00a0Understanding Core Modules in Node.js\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/\",\"name\":\"Sharpener Tech\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/#organization\",\"name\":\"Sharpener Tech\",\"url\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/wordpress-prod.sharpener.tech\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/Sharpener_logo-removebg-preview.png\",\"contentUrl\":\"https:\\\/\\\/wordpress-prod.sharpener.tech\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/Sharpener_logo-removebg-preview.png\",\"width\":187,\"height\":62,\"caption\":\"Sharpener Tech\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/#\\\/schema\\\/person\\\/eb9482df421e52d30f961eae8a0fd67a\",\"name\":\"Julian Toppo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/87799fed7134aa3bb27606b4eceeb577117023517d38b0152340c9e59376052c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/87799fed7134aa3bb27606b4eceeb577117023517d38b0152340c9e59376052c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/87799fed7134aa3bb27606b4eceeb577117023517d38b0152340c9e59376052c?s=96&d=mm&r=g\",\"caption\":\"Julian Toppo\"},\"url\":\"https:\\\/\\\/www.sharpener.tech\\\/blog\\\/author\\\/julian\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u00a0Understanding Core Modules in Node.js - Sharpener Tech","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/","og_locale":"en_US","og_type":"article","og_title":"\u00a0Understanding Core Modules in Node.js - Sharpener Tech","og_description":"Hey everyone! Welcome back. Today, we\u2019re diving into something every Node.js developer needs to understand \u2013 Core Modules in Node.js. What are Core Modules?Why do we need them?How do they&hellip;","og_url":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/","og_site_name":"Sharpener Tech","article_published_time":"2025-05-29T10:45:40+00:00","article_modified_time":"2025-05-29T11:33:22+00:00","og_image":[{"width":1536,"height":1024,"url":"https:\/\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\/blog\/wp-content\/uploads\/2025\/05\/29104439\/ChatGPT-Image-May-29-2025-04_13_20-PM.jpg","type":"image\/jpeg"}],"author":"Julian Toppo","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Julian Toppo","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/#article","isPartOf":{"@id":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/"},"author":{"name":"Julian Toppo","@id":"https:\/\/www.sharpener.tech\/blog\/#\/schema\/person\/eb9482df421e52d30f961eae8a0fd67a"},"headline":"\u00a0Understanding Core Modules in Node.js","datePublished":"2025-05-29T10:45:40+00:00","dateModified":"2025-05-29T11:33:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/"},"wordCount":1390,"commentCount":0,"publisher":{"@id":"https:\/\/www.sharpener.tech\/blog\/#organization"},"image":{"@id":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/#primaryimage"},"thumbnailUrl":"https:\/\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\/blog\/wp-content\/uploads\/2025\/05\/29104439\/ChatGPT-Image-May-29-2025-04_13_20-PM.jpg","articleSection":["Tips"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/","url":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/","name":"\u00a0Understanding Core Modules in Node.js - Sharpener Tech","isPartOf":{"@id":"https:\/\/www.sharpener.tech\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/#primaryimage"},"image":{"@id":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/#primaryimage"},"thumbnailUrl":"https:\/\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\/blog\/wp-content\/uploads\/2025\/05\/29104439\/ChatGPT-Image-May-29-2025-04_13_20-PM.jpg","datePublished":"2025-05-29T10:45:40+00:00","dateModified":"2025-05-29T11:33:22+00:00","breadcrumb":{"@id":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/#primaryimage","url":"https:\/\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\/blog\/wp-content\/uploads\/2025\/05\/29104439\/ChatGPT-Image-May-29-2025-04_13_20-PM.jpg","contentUrl":"https:\/\/sharpener-wordpress.s3.ap-south-1.amazonaws.com\/blog\/wp-content\/uploads\/2025\/05\/29104439\/ChatGPT-Image-May-29-2025-04_13_20-PM.jpg","width":1536,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/www.sharpener.tech\/blog\/understanding-core-modules-in-node-js\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sharpener.tech\/blog\/"},{"@type":"ListItem","position":2,"name":"\u00a0Understanding Core Modules in Node.js"}]},{"@type":"WebSite","@id":"https:\/\/www.sharpener.tech\/blog\/#website","url":"https:\/\/www.sharpener.tech\/blog\/","name":"Sharpener Tech","description":"","publisher":{"@id":"https:\/\/www.sharpener.tech\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sharpener.tech\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.sharpener.tech\/blog\/#organization","name":"Sharpener Tech","url":"https:\/\/www.sharpener.tech\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sharpener.tech\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/wordpress-prod.sharpener.tech\/wp-content\/uploads\/2026\/05\/Sharpener_logo-removebg-preview.png","contentUrl":"https:\/\/wordpress-prod.sharpener.tech\/wp-content\/uploads\/2026\/05\/Sharpener_logo-removebg-preview.png","width":187,"height":62,"caption":"Sharpener Tech"},"image":{"@id":"https:\/\/www.sharpener.tech\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.sharpener.tech\/blog\/#\/schema\/person\/eb9482df421e52d30f961eae8a0fd67a","name":"Julian Toppo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/87799fed7134aa3bb27606b4eceeb577117023517d38b0152340c9e59376052c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/87799fed7134aa3bb27606b4eceeb577117023517d38b0152340c9e59376052c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/87799fed7134aa3bb27606b4eceeb577117023517d38b0152340c9e59376052c?s=96&d=mm&r=g","caption":"Julian Toppo"},"url":"https:\/\/www.sharpener.tech\/blog\/author\/julian\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sharpener.tech\/blog\/wp-json\/wp\/v2\/posts\/1453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sharpener.tech\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sharpener.tech\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sharpener.tech\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sharpener.tech\/blog\/wp-json\/wp\/v2\/comments?post=1453"}],"version-history":[{"count":2,"href":"https:\/\/www.sharpener.tech\/blog\/wp-json\/wp\/v2\/posts\/1453\/revisions"}],"predecessor-version":[{"id":1461,"href":"https:\/\/www.sharpener.tech\/blog\/wp-json\/wp\/v2\/posts\/1453\/revisions\/1461"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sharpener.tech\/blog\/wp-json\/wp\/v2\/media\/1454"}],"wp:attachment":[{"href":"https:\/\/www.sharpener.tech\/blog\/wp-json\/wp\/v2\/media?parent=1453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sharpener.tech\/blog\/wp-json\/wp\/v2\/categories?post=1453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sharpener.tech\/blog\/wp-json\/wp\/v2\/tags?post=1453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}