Kinda Code
Home/Node/Page 3

Node

Node.js tutorials, tips & tricks
Express + TypeScript: Extending Request  and Response objects

Express + TypeScript: Extending Request and Response objects

Updated: Jul 12, 2022
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......
Node.js: How to Ping a Remote Server/ Website

Node.js: How to Ping a Remote Server/ Website

Updated: Jul 12, 2022
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,......
How to Resize Images using Node.js

How to Resize Images using Node.js

Updated: Jul 12, 2022
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,......
Get the Number of CPU Cores in Node.js

Get the Number of CPU Cores in Node.js

Updated: Jul 12, 2022
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......
Check computer RAM size with Node.js

Check computer RAM size with Node.js

Updated: Jul 12, 2022
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......
Node + Express: How to Return XML Response

Node + Express: How to Return XML Response

Updated: Jul 12, 2022
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......
How to Delete a File or Directory in Node.js

How to Delete a File or Directory in Node.js

Updated: Jul 12, 2022
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......
Node.js: Ways to Create a Directory If It Doesn’t Exist

Node.js: Ways to Create a Directory If It Doesn’t Exist

Updated: Jul 12, 2022
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......
How to install Redis on macOS, Windows, and Ubuntu

How to install Redis on macOS, Windows, and Ubuntu

Updated: Jul 12, 2022
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......
4 Ways to Convert Object into Query String in Node.js

4 Ways to Convert Object into Query String in Node.js

Updated: Jul 12, 2022
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......
The Best Way to Upgrade Node.js on Mac

The Best Way to Upgrade Node.js on Mac

Updated: Jul 10, 2022
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......
How to Generate Slugs from Titles in Node.js

How to Generate Slugs from Titles in Node.js

Updated: Jul 10, 2022
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......