The open-source Node.js project released its first major update of 2022 on April 19 with the launch of Version 18.
The new release adds a series of incremental capabilities, as well as security features that were not available in prior LTS updates.
Among the security improvements in Node.js 18 is support for the OpenSSL 3.0 cryptographic library. This isn’t the first time OpenSSL 3.0 is being seen in Node.js, but it is the first time it is available in an LTS update.
“Node.js 17 will not be promoted to long-term support — only even-numbered release lines get promoted to long-term support,” Bethany Griggs, Node.js Technical Steering Committee member and a senior software engineer at Red Hat, told ITPro Today. “Many enterprises stick to the LTS release lines, so the OpenSSL 3.0 inclusion is significant for Node.js 18 as it will be the first long-term support release including this version.
The last LTS update, according to Griggs, was Node.js 16, which included OpenSSL 1.1.1.
“The update to OpenSSL 3.0 was necessary for Node.js 18, as OpenSSL 1.1.1 will reach the end of support on 2023-09-11, which is before our proposed end-of-life date for Node.js 18,” she said. “Node.js developers need to be aware of this upgrade because the update has tightened some restrictions on the allowed algorithms and key sizes.”
If any user applications are using APIs that are no longer enabled by default in OpenSSL 3.0, they may need to make adjustments to their applications when upgrading to Node.js 18, Griggs said.
Fetch API Improves Requests in Node.js 18
Node.js 18 also introduces the new Fetch API.
“The new Fetch API in Node.js v18 allows users to quickly and seamlessly make HTTP requests,” Ethan Arrowood, senior software engineer at Vercel, told ITPro Today. “In as few as two lines of code, a developer can request data and parse the response into a usable format.”
Previous versions of Node.js required the use of a callback-based request method, which required the user to handle the response data stream manually, Arrowood said.
Node.js 18 also provides a preview of Web Streams API, which enables an optimized approach to streaming data.
“The implementation of the Web Streams API furthers the effort to increase compatibility with the larger Web Platform ecosystem,” James M. Snell, Node.js Technical Steering Committee member and system engineer at Cloudflare, told ITPro Today. “Web Streams are implemented in all major web browsers and non-browser runtimes such as Deno, Cloudflare Workers, and Node.js, allowing code conforming to the API to work across all environments.”
The Next 10 Years of Node.js
The continued development and future direction of the Node.js open-source project are in part being guided by an initiative known as The Next 10.
“The Next 10 aims to guide the strategic directions for the next 10 years of Node.js — building and reflecting on the successful first 10 years of Node.js,” Griggs said.
“Each deep-dive discussion has led to some key actions and outcomes being defined,” Griggs said. “For example, the introduction of the Fetch API was discussed during the modern HTTP deep dive, which will now be available by default in Node.js 18.”