Articles tagged in: Node.js



Nested Destructuring in JavaScript or Node.js

JavaScript introduced the destructuring assignment back in 2015. The destructuring assignment is a way to unpack properties of an object or items from arrays into variables using a syntax that looks like objects or arrays. This tutorial shows you how to use nested destructuring in JavaScript. {{outline}} Using Nested Destructuring …

Continue Reading

Node.js — Fix „Socket Hang Up“ Errors

Node.js published the first release of version 19.0.0 on October 18th, 2022. After that, we updated some of the Supercharge packages to run tests for Node.js 19 to ensure compatibility of the packages. One hiccup we noticed were the test runs for the @supercharge/sttp package. …

Continue Reading

Node.js — How to Count Words in a File

Sometimes you want to count the number of words in a given string. This string value may come from a variable, a database column, or the content of a file. For example, you can calculate the reading time of a text using a text’s word count. This tutorial shows …

Continue Reading

Node.js — Constant for Platform-Specific Newline

Operating systems use different end-of-line markers indicating a new line after the given marker. For example, POSIX systems (like Linux and macOS) use \n and Windows uses \r\n. This tutorial shows you how to retrieve a platform-specific EOL marker depending on the operating system that runs your code. {{outline} …

Continue Reading

Node.js — Calculate a SHA256 Hash

Node.js comes with a built-in crypto module and a bundled version of OpenSSL. The crypto module wraps OpenSSL providing an API for cryptographic functions. Node.js’ crypto module provides a createHash method allowing you to calculate hashes of given content. This tutorial shows you how to use the createHash …

Continue Reading

Node.js — Calculate an MD5 Hash

Node.js comes with the crypto module that provides a lot of useful methods for data encryption and hashing. There’s a built-in function to calculate an MD5 hash for a given value. This tutorial shows you how to hash a given string using the MD5 algorithm. {{outline}} Calculate an …

Continue Reading

Explore the Library

Find interesting tutorials and solutions for your problems.