Categories
Node.js What's new in Node.js core?

What’s new in Node.js core? March 2022 edition

3 min read

It’s been just over six months since I published the first edition of ‘What’s new in Node.js core?’. A lot of new features have shipped in Node.js Core since then, so it felt like a good time to put together a new edition.

You can find all the code examples in this edition on GitHub (I’ll be continuing to add examples there, so you might want to give it a "watch").

The pace at which new features are being implemented and shipped is really quite impressive. A massive thank you to all the Node.js contributors for their huge efforts in pushing the Node.js project forward.

🌟 New features

Deep clone values with structuredClone()

We no longer need to use hacks to deep clone objects in Node.js.

Automatically cancel async operations with AbortSignal.timeout()

In Node.js you can now automatically cancel async operations, such as a slow HTTP request.

The Fetch API in Node.js

Making HTTP requests in Node.js just got easier with an experimental Fetch API implementation.

Import JSON in ES modules

Node.js now supports importing JSON files in ES modules without the need to pass an experimental flag.

Provide context with abortSignal.reason

It’s now possible to provide a reason value when triggering an abort signal in Node.js.

Avoid boilerplate code when handling abort signals

The abortSignal.throwIfAborted() method makes it easier to write code that handles abort signals.

Take advantage of promise-based APIs in Node.js

There’s another pretty new promise-based API in Node.js core: the readline/promises API.

🎞️ Video walkthrough

I’ll be recording a video walkthrough of code examples using these new features. Drop your email address in below if you’d like to watch the preview when it’s ready.

I won’t send you spam. Unsubscribe at any time.

💎 Other notable features

Here are some other notable features that have landed in Node.js core recently:

📅 Node.js releases

There are a few things to highlight about the Current and Long Term Support (LTS) Node.js release lines:

  • v12 is end-of-life (EOL) at the end of April — The v12 release line enters end-of-life status on April 30th 2022. It will no longer receive critical bug fixes or security patches.
  • v16 is the Active LTS release line — Since October 26th 2021 (v16.13.0). In production you should ideally be using a v16 or v14 release. v14 is in Maintenance LTS until April 30th 2023.
  • v18 release coming soon — This will include all the features that have been baking in the v17 (Current) release line. Initial release scheduled for April 19th 2022, see the Version 18.0.0 release issue on GitHub for what will be included. Will enter Active LTS on October 25th 2022.

If you want to learn more about how the Node.js release schedule works, check out the Long Term Support (LTS) schedule page on the Node.js website.

Fun fact: Once v12 is EOL, top-level await is in all supported versions of Node.js (shared by Myles Borins on Twitter). Nice!

Leave a Reply

Your email address will not be published. Required fields are marked *