This article shows you how to add new properties to an Express request object (we often deal with this task when working with middleware) or an Express response (not too common but may be necessary in some certain cases) object in a......
This article shows you a couple of different ways to programmatically ping a remote server or a website from within your Node.js application (to get some network information like latency, IP address, …). In the first approach,......
This article walks you through a couple of different ways to programmatically resize images in Node.js. Using sharp The sharp package is fast in converting large images to smaller ones. It works well with JPEG, PNG, WebP, GIF,......
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 can......
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......
This article walks you through a few examples of responding in XML when using Express and Node.js. Besides express, we don’t need any other npm libraries. Example 1: Basic This example creates a list of fiction products and......
This article shows you a couple of different ways to remove a file or a directory using Node.js. We’ll use modern Javascript (ES6 and newer) and the latest features provided by Node.js core. No third-party libraries need to be......
This article walks you through a couple of different ways to create a directory if it doesn’t exist in Node.js. Using the FS module FS, which stands for “file system”, is a standard module of Node.js so you......
This article shows you how to install and get Redis ready to use on macOS, Windows, and Ubuntu. macOS The easy and reliable way to install Redis on a Mac is using Homebrew (a free, popular, and open-source software package......
This article shows you a couple of different ways to convert (stringify) objects into query strings in Node.js. Using URLSearchParams API The URLSearchParams class comes with the URL module and is available on the global object......
Node.js is updated very often to fix bugs, improve performance and add new features. This article shows you how to correctly upgrade Node.js and npm in macOS. The Steps 1. Go to nodejs.org, the official website of Node.js, to......
This article shows you a few approaches to generating a slug from a title in Node.js. The first one is to use self-written code and the other is to use a third-party package. Introduction A slug is the part of a URL that......