Node.js 18 Released: Top new features and updates

    Monday, May 23, 20225 min read13354 views
    Node.js 18 Released: Top new features and updates

    With effective and robust web designs gaining notable importance in this digital era, node.js stands out to be the optimal choice for developing responsive web designs.

    Node.js is the most popular pick among developers for creating data-driven and scalable real-time applications. It is one of the most efficient Javascript runtime environments, with support for REST APIs, desktop and mobile apps.

    The Node.js landscape keeps on updating continuously in order to reinforce the functionality and operationality of the framework.

    The current version of Node.js 17 is now been upgraded to Node.js 18. Finally, the Node.js community has released its latest version of Node v18.0.0. Node.js 18 was released on 19 April 2022, which is now available as a “ current” release for the upcoming 6 months and will then be available as an LTS version in October 2022.

    The codename for this Node.js 18 release will be 'Hydrogen' after it is upgraded to long-term support and will be supported until April 2025.

    The latest Node.js 18 features include an upgrade to version 10.1 of the V8 Javascript engine, global fetch enabled by default, and the addition of a core test runner module.

    Let’s have a brief overview of the key highlights and newest features of Node.js 18.

    1. Global fetch enable by default

    Fetch is a widely used API on the web for conducting HTTP requests or any other type of network request. Previously, developers had to install multiple packages in order to retrieve responses from various APIs and process the data.

    If you wanted to make an HTTP request, you had two options: use third-party packages or create the request from scratch. But Node.js v18 has addressed the concern by making this available in the default package and so no need to install it separately.

    Global fetch API is now available by default. To perform HTTP requests previously, you had to use the XMLHttpRequest API, which needed many lines of code to make a request.

    With the advent of this prominent Node.js 18 feature, it is now easier to make an HTTP request using the Fetch API.

     Example of fetch

    const res= await fetch('');
    { cont data= await res.json();

    The following globals are now available as a result of this addition in the Node.js 18 features :

    • fetch
    • FormData
    • Headers
    • Request
    • Response.

    In order to add it to your Node.js project just run the following command:

    npm install node-fetch

    The API will be considered experimental until further test coverage is introduced and contributors have validated that the API implements as many of the requirements as possible.

    2. Update of V8 JavaScript Engine to 10.1

    We all are aware that Node.js executes Javascript code using the Google V8 engine. With V8 engine, the compilation of Javascript code into native machine code becomes much easier. This eventually boosts the performance of web server applications.

    With the release of the Node.js 18 version, the V8 engine has been updated to version 10.1, which is a part of chromium 101.

    The following new vector methods are added with the introduction of this Node.js 18 feature:

    • The findLast() and findLastIndex() array methods.
    • Upgradations to the Intl.Locale API.
    • The Intl. supportedValueOf function
    • Improved performance of class fields and private class methods

    3. Core test runner module

    Until now, the node.js frameworks have never had a built-in test runner. With the advancement in the Node.js framework, the test runner module is only available using the node: prefix.

    With this Node.js 18 feature, the need for external packages to create tests has now been eliminated.

    The core test runner module does not fully replace existing test runner modules such as jest or mocha. However, it does provide a direct and instant way to execute a test suite without requiring any other dependencies.

    The node: test module makes it easier to create JavaScript tests that return results in TAP format. For this, run the following command

    import 'node:test' as a test; ( put in code)

    Several packages are available for testing the Node.js application developed, but now with this new Node.js 18 feature, the application can be tested with the inbuilt module.

    Some other advancements

    1. Web Stream APIs

    The sounds to be the most astounding Node.js 18 features i.e. the worldwide exposure of the experimental Webstream API, which can be used in web application development.

    Here’s the list of some of the APIs that are now globally available:

    • ReadableStream
    • ReadableStreamDefaultReader
    • ReadableStreamBYOBReader
    • ReadableStreamBYOBRequest
    • ReadableByteStreamController
    • ReadableStreamDefaultController
    • TransformStream
    • TransformStreamDefaultController
    • WritableStream
    • WritableStreamDefaultWriter

    2. HTTP Timeouts

    In Node.js 18, the http.server timeouts have been altered. RequestTimeout is set to 300000 milliseconds (5 minutes) by default, and headersTimeout is set to 60000 milliseconds (60 seconds).

    Final thoughts

    Most software engineers and web developers consider Node to be the most compelling single piece of software within the current Javascript ecosystem. In addition to using responsive web design, developers nowadays need to build multi-user and real-time web applications.

    Node.js enables programmers to create complex communication applications and is the most extensively used framework for developing web and mobile apps.

    Node.js has gained trust amongst the big tech giants in the industry including Netflix, LinkedIn, IBM, Paypal, Walmart, GoDaddy, and many more.

    The Node.js community members are constantly engaged in upgrading the framework to introduce more APIs, optimize the run time, create a better developer experience, usability, etc.

    Also, it should be noted that Node.Js 12 will no longer be supported and it will go End-of-life in April 2022. So upgrade it to Node.js 14 (LTS) or Node.js 16 (LTS)

    To ensure future compatibility of your project with the latest Node.js features make sure to keep it upgraded to keep your application more secure, and reliable.

    Upgrade your software now to avail the new features of Node.js 18!

    Read More: Angular 13: Top New Features And Updates


    Related articles

    This website uses cookies to analyze website traffic and optimize your website experience. By continuing, you agree to our use of cookies as described in our Privacy Policy.