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

What’s new in Node.js core? September 2021

< 1 min read

This series of blog posts was inspired by a thread which I posted on Twitter.

🔤 Generate v4 UUIDs without needing the uuid library

If you want to generate v4 UUIDs in Node.js e.g. d2c14405-a3dd-4fcc-b13b-bc649fe1a0bf, you no longer need to add the uuid library as a dependency. You can use crypto.randomUUID() instead.

Read more

🛑 Cancel async operations with AbortController

If you want to cancel an async operation in Node.js, such as an HTTP request, you can now use the built in AbortController and AbortSignal classes. They were originally introduced in the Web Platform APIs, which are implemented by web browsers.

Read more

📦 Make your imports clearer with the node: protocol

You can use the node: protocol to make it clear in your code when you’re importing built in Node.js modules. It makes it much easier to tell which modules are third-party dependencies.

Read more

🌟 Take advantage of promise-based APIs in Node.js

You can use util.promisify() to wrap callback-based APIs in Node.js core. But did you know that Node.js provides several promise-based APIs too? You can use them with async / await, no wrapping needed! There are two new promise-based APIs in Node.js core: timers/promises and stream/promises.

Read more