Node.js: How to Compress a File using Gzip format

November 29, 2021 A Goodman

In Node.js, you can compress a file using the Gzip format by using streams. We can get the job done with just a few lines of code and there is no need to install any third-party…

Node.js: The Maximum Size Allowed for Strings/Buffers

November 29, 2021 Guest Contributor

Buffers and strings in Node.js are limited in size. The actual maximum size of a buffer or a string changes across platforms and versions of Node.js. You can check yours as follows: Here’s my output: Further…

4 Ways to Read JSON Files in Node.js

November 23, 2021 A Goodman

This article walks you through a bunch of different ways to read JSON files in Node.js. Without any further ado, let’s get our hands dirty by writing some code. Getting Started This is the sample JSON…

Node.js: Using __dirname and __filename with ES Modules

November 18, 2021 A Goodman

If you’re building a Node.js application with ES modules instead of CommonJS modules (“import” instead of “require”, in simpler terms), you have to do something before writing __filename and __direname in your code. The Problem In…

Tweaking a Node.js Core Module

November 18, 2021 The Plumber

The example below shows you how to change the behavior of a Node.js core module by modifying or extending it. What we are going to do should not appear in serious products but might be somehow…

Node.js: Getting User Input from Console (2 approaches)

November 18, 2021 A Goodman

This article walks you through a couple of different ways to get user input from the console in a Node.js program. The first approach is to do things from scratch with only built-in features of Node.js….

Node.js: Use Async Imports (Dynamic Imports) with ES Modules

November 17, 2021 Pennywise

Overview Nowadays, many modern Node.js applications use ES modules (that go with the import keyword) instead of CommonJS modules (that go with the require keyword). When working with ES modules, there might be scenarios where you…

How to Install Node.js on Ubuntu 21.04 and 21.10

November 14, 2021 Pennywise

This article shows you how to install Node.js and NPM on Ubuntu 21.04 (Hirsute Hippo) or Ubuntu 21.10 (Impish Indri). Our goal is to get the LTS (the long-term support version, which is officially recommended for…

Node.js: Generate Images from Text Using Canvas

November 10, 2021 A Goodman

The example below shows you how to programmatically generate images from text in Node.js by using the canvas library. Example Here’s the image we are going to “draw” with code: The code 1. Install the library:…

Node.js: Reading and Parsing Excel (XLSX) Files

November 10, 2021 A Goodman

This article shows you how to read and extract content from an Excel (.xlsx) file by using Node.js. Without any further ado, let’s get our hands dirty and start coding. Getting Things Ready We are going…

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

November 9, 2021 A Goodman

This article shows you a couple of different ways to 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,…

Express + TypeScript: Extending Request and Response objects

October 21, 2021 The Plumber

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…

1 2 3 4