Amazing Features Of Node.js 14

Amazing Features Of Node.js 14

In 2019, Node.js turned 10 years old and its downloads are continuously growing 40% year over year. Recently, Node.js joined the OpenJS Foundation which ensures to improve project health, sustainability, and also a collaboration with the JavaScript community to a great extent. Every year the Node.js community has gained momentum and this will surely continue in 2020 too. The new version Node.js 14 was launched on April 21, 2020. This new version comes with some features and improvements that encourage developers to incorporate the capacity of data storing through online request and in-built diagnostic reporting.  Let see some highlights of Node.js 14-

Node.js 14-

The 14.x release comes with experimental Async Local storage API  to efficiently manage context across Asynchronous Calls over multiple releases. It also includes a new compiler, platform minimums, and an experimental Web Assembly System Interface.

Features Of Node.js 14-

1. V8 upgraded to V8 8.1-

The new version of V8 JavaScript engine come with execution changes and improvements just as keeping Node.js up with the continuous improvements in the language and runtime. 

2. Streams-

This version includes many changes marked as SemVer major in the Node.js Streams implementation. These are the changes to improve consistency across the Streams APIs to remove ambiguity and streamline behaviors across the various parts of Node.js core. 

3. Node.js Can Import WebAssembly Modules-

With ES module support comes the ability to import WebAssembly modules. It is a portable compiled binary format that can be parsed faster than JavaScript and executed at native speed. WebAssembly modules can be created using a language like  C/C++, Go, C#, Java, Python, Elixir, Rust and so on.

To allow the module support, you should pass a command line flag when  executing a Node.js application. For eg., 

node --experimental-wasm-modules index.js

Consider, you have an image processing library implemented as a WebAssembly module.

The syntax for using this Wasm module is-

import * as imageUtils from "./imageUtils.wasm";
import * as fs from "fs";
( async () => {
   const image = await fs.promises.readFile( "./image.png" );
   const updatedImage = await imageUtils.rotate90degrees( image );
} )();

You can also import WebAssembly module using the new dynamic import() statement in Node.js.

"use strict";
const fs = require("fs");
( async () => {
   const imageUtils = await import( "./imageUtils.wasm" );
   const image = await fs.promises.readFile( "./image.png" );
   const updatedImage = await imageUtils.rotate90degrees( image );
} )();

4. WebAssembly System Interface (WASI)-

Just like JavaScript, WebAssembly is designed to prevent access to any underlying operating system, sometimes called “sandboxed”. 

However, there are times when a WebAssembly module in your control in Node.js may profit by having the option to make system-level calls. And here comes the new WebAssembly System Interface (WASI).  It is designed to be a standard interface for making calls to the system such as host applications, native operating systems, and so on. Initial WASI support was now committed to the Node.js project. WASI is an amazing feature that we can see in 2020.

5. Diagnostic Reports Launch In 2020-

Diagnostic reports are JSON-formatted human-readable summaries of process information that include call stacks, operating system information, loaded modules, and other useful data to help in supporting applications. These reports can be triggered on unhandled exceptions, fatal errors, a process signal or using the new API. Node.js can be configured to save diagnostic reports to a specified folder and file name. To allow this feature, you should pass a command-line flag when executing a Node.js application. For eg., 

node --experimental-report --report-uncaught-exception --report-filename=./diagnostics.json index.js

6. Removal Of Experimental Modules Warning-

According to Node.js 14 there will not be a warning while using ESM in Node.js. But the ESM implementation in Node.js is still experimental but we can believe that we are close to being able to call ESM in Node.js “stable”. Removal of warning is a huge step in this direction.

7. Platform Minimums And New Compiler-

For some platforms, Node.js provides pre-built binaries. For each prime release, minimum toolchains are measured and raised where required.

This release coincides with all of macOS binaries to compile on macOS 10.15 (Catalina) with Xcode 11 to support package notarization. As binaries are still being compiled to help the compile goals for the release lines, it can not be said that this will have a bad effect on Node.js users on previous versions of macOS.  The minimum macOS target version has been knocked for Node.js 14 to macOS 10.13 (High Sierra). For Node.js 14, the minimum GCC level on the Linux based platforms stays at GCC 6.

In spite of that, the binaries will be conceivably made or released for a couple of platforms with GCC 8. Also, Node.js won’t run on End-of-Life Windows deployments.

Other Node.js Updates for 2020-

  • An Updated V8 JavaScript engine: V8 v7.8 and 7.9 increase performance and Wasm support.
  • QUIC protocol support: a modern support for connected applications with increased performance and reliability.
  • Better Python 3 build support: in 2020 it should be possible to build Node.js and native modules using Python 3.
  • Stable Workers Threads API: Worker threads in Node.js enable parallel, CPU-intensive JavaScript operations.

You can also know- When, How And Why Use Node.js as Your Backend?

Wrap up-

These are some of the new features that you will see in 2020 for the node.js 14 version. There can be others too. Are you thinking to develop your next software with Node.js? You should consult with solace experts before you start. We have experts to help you through consultation and development with the latest versions. You can hire node.js developers of Solace team for effective software development. Connect with solace and get a free quote for your next software development. We will be happy to help you.

Related Post