Excluding node_modules when using tree command on Mac

May 28, 2020 A Goodman

The node_modules folder is often super big and contains countless files and subdirectories. Therefore, when using the tree command to display your project structure, you should ignore node_modules. To do so, try this: The result: If…

Express: Automatically download an image when clicking a link

February 21, 2021 A Goodman

The simple project below will show you how to automatically download an image served from Express server when clicking a link. Our project structure: The code in app.js (don’t forget to install express before running your…

Node.js: 2 Ways to Colorize Console Log Output

April 21, 2021 A Goodman

By default, when you print something by using console.log() in Node.js, the output is usually white if your terminal has a dark background color or black if your terminal has a light background color. If you…

A few examples of exports and require in Node.js

February 10, 2020 A Goodman

A few easy-to-understand examples below will help you understand “exports” and “require” in Node.js better. Example 1 Exports (file your-file.js): Require (file index.js) Examples 2 Export (call it your-file.js or whatever you like): Require:

How to get all Links from a Webpage using Node.js and Cheerio

January 22, 2021 A Goodman

Node.js is a javascript runtime environment that helps you create high-performance apps. Because Node.js functions are non-blocking (commands execute concurrently or even in parallel, it can perform large tasks without incurring the cost of thread context…

1 2 3 4