Using Axios to download images and videos in Node.js

March 19, 2022 A Goodman

Node.js is an asynchronous event-driven Javascript runtime that is designed to build scalable network applications. When handling files (from small images to large videos) with Node.js, you are free from the worries of dead-lock the process…

Check computer RAM size with Node.js

October 1, 2021 A Goodman

The built-in os module in Node provides methods that help you check your machine’s memory size: os.totalmem(): Returns the total amount of system memory in bytes. freemem(): Returns the amount of free system memory in bytes….

Get the Number of CPU Cores in Node.js

October 1, 2021 A Goodman

The standard module os of Node.js provides a lot of operating system-related utilities. The os.cpus() method returns an array of objects containing information about each logical CPU core. To count the number of CPU cores, we…

Excluding node_modules when using tree command on Mac

February 23, 2022 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 file structure, you should ignore node_modules. To do so, try this: The result:…

Node + Express: Download files with

March 19, 2022 The Shadow

The example below shows you how to automatically download an image served from Express server when clicking a link. 1. Navigate to the folder you want your project to lie in then run: 2. Install express:…

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 23, 2022 A Goodman

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

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

March 19, 2022 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 heavy tasks without incurring the cost of thread context…

1 3 4 5