Quick Summary:

Node Js is one of the highly preferred frameworks for application development. This blog post will provide all the required information on What’s new in Node Js 18, the features of Node Js 18, and reasons to choose Node 18 over Node 17.

Introduction

Node Js is an open-source JavaScript runtime environment specially used for back-end development. The Previous version of Node Js was Node Js 17, which got replaced with Node Js 18, released on 19th April 2022. One of the biggest features of Node Js 18 is its updated JavaScript V8 engine 10.1 and, by default, enabled Global fetch.

Node Js 18 will work as the current release for the first six months of release, and after the completion of six months in October 2022, Node Js 18 will be converted into Long Term Support ( LTS ) version. Once it gets into LTS, this LTS release will be known as Hydrogen. Node Js 18 will be in support till April 2025.

The below image showcases the previous versions of Node Js

previous versions of Node Js

Latest Features of Node Js 18

As the latest version of Node Js is released, you must be curious to know the latest features of Node Js 18. Here is a quick list of features:

Globally Available Browser Compatible APIs

Fetch: In Node Js 18, you will get an experimental (testing )global fetch API by default. This Experimental API will continue testing until the overall testing and contributors verify that it is viable to implement.

Example of Global fetch API

Copy Text
const res = await fetch('https://nodejs.org/api/documentation.json');
if (res.ok) {
  const data = await res.json();
  console.log(data);
}

Web Stream API: In Node Js 18, you are going to get the global exposure of experimental Webstream API that can be used in web application development.

Below are few webstream API that is going to be available for all:

  • ReadableStream
  • ReadableStreamDefaultReader
  • ReadableStreamBYOBReader
  • ReadableStreamBYOBRequest
  • ReadableByteStreamController
  • ReadableStreamDefaultController
  • TransformStream
  • TransformStreamDefaultController
  • WritableStream
  • WritableStreamDefaultWriter
  • WritableStreamDefaultController
  • ByteLengthQueuingStrategy
  • CountQueuingStrategy
  • TextEncoderStream
  • TextDecoderStream
  • CompressionStream
  • DecompressionStream

Experimental Test Runner Module

The Node Js 18 node:test module provides a smooth process of creating JavaScript test reports in TAP format. The best to access the result is: import test from ‘node:test’;

Example of the Test runner module

Copy Text
test('top level test', async (t) => {
  await t.test('subtest 1', (t) => {
    assert.strictEqual(1, 1);
  });

  await t.test('subtest 2', (t) => {
    assert.strictEqual(2, 2);
  });
});

Compiler And Toolchain Upgrades

Node Js always provides prebuilt binaries for various platforms. For every latest release, toolchains are evaluated and elevated whenever required.

Node Js 18 Prebuilt libraries for various platforms are mentioned below:

  • Linux prebuilt libraries are now developed (RHEL 8). It is flexible with Linux distribution on Glibc 2.28.
  • You must have macOS 10.15 or later to use prebuilt libraries for macOS.
  • Minimum supported architecture is raised from 7 to 8 for AIX.
  • Due to some issues with V8 in Node Js, it won’t be possible to get prebuilt libraries for 32-bit windows initially.

V8 10.1

In the Node Js 18 version V8 engine has been updated to version 10.1, which is also the part of chromium 101.

Build Time User-Land Snapshot

In Node 18 users can now develop Node.js binary with experimental custom V8 snapshot with the help of –node-snapshot-main flag.

Example to understand

Copy Text
$ cd /path/to/node/source

# Specifying an entry point of the snapshot, for example,
# a UMD module like the marked markdown renderer which in
# this case should initialize the renderer and stores in
# globalThis.
$ ./configure --node-snapshot-main=marked.js

# Build the binary
$ make node

HTTP Timeouts

By default time for the HTTP header is now set to 60 seconds with the help of the server.headersTimeout. In addition, for receiving user or client requests, the default time is set to 5 minutes in Node Js 18.

To use Node Js 18, click on the download link to access the direct download link.

Why You Should Upgrade Your Existing Project From Node 17 to 18

  • One of the key reasons to shift from Node 17 to Node 18 is the version upgrade of the V8 engine to 10.1.
  • Enhancement in Intl.Locale API.
  • Performance improvement in both class fields and private class methods.

Key Take Away on Node Js 18

The creators of Node Js have always tried to provide the best possible solution to their users, and that’s the reason why the Node Js has always come up with the upgraded version by fixing bugs, issues, and providing additional features in every version. Node 18 is the current release. If you want to upgrade your Node Js web application with the latest version by taking advantage of the features of Node Js 18 to keep your application secure, scalable, and reliable, contact the Node Js development company for the best solution.

Frequently Asked Questions (FAQs)

There are API functions in Node Js Asynchronous and non-blocking functions. However, after the latest version release of Node Js ( Node Js 18 ), two additional globally available ( API fetch and webstream API ) are in the experiment.

Node Js has released its latest version Node 18, which has come up with the solution and additional features compared to older versions. Therefore, you need the latest version to keep your web application updated.

LTS is a short form of Long Term Support. Node Js provides this long-term support to provide extended support in a specific version. For example, the Node 18 is the latest version that will provide extended support until April 2025.

Node.js Tutorials

Tutorials for Programmers of All Levels

EXPLORE NOW

Get In Touch

[email protected]

Your Success Is Guaranteed !

We accelerate the release of digital product and guaranteed their success

We Use Slack, Jira & GitHub for Accurate Deployment and Effective Communication.

How Can We Help You?