The Important Features and Fixes of Node.js Version 8

RisingStack's services:


Node.js Experts

Learn more at

Sign up to our newsletter!

In this article:

With the release of Node.js Version 8 (happening on 12 PM PST 30 May), we got the latest LTS (long-term support) variant with a bunch of new features and performance improvements.

In this post, we’ll go through the most important features and fixes of the new Node.js 8 release.

Compared to previous Node.js major releases, 8.0.0 is rather huge. Lots going on, lots to talk about. But also very stable and well tested— James M Snell (@jasnell) May 30, 2017

The codename of the new release is Carbon. Node 8 will become the current LTS version from October 2017 and will be maintained till December 31st, 2019. This also means that Node.js Version 6 will go into maintenance mode in April 2018, and reach the end of life in April 2019.

You can grab the nightly releases from here:

Introducing the Async Hooks API

The Async Hooks (previously called AsyncWrap) API allows you to get structural tracing information about the life of handle objects.

The API emits events that inform the consumer about the life of all handle objects in Node.js. It tries to solve similar challenges as the continuation-local-storage npm package, just in the core.

If you are using continuation-local-storage, there is already a drop-in replacement that uses async hooks, called cls-hooked – but currently, it is not ready for prime time, so use it with caution!

How The Async Hooks API Works in Node.js Version 8

The createHooks function registers functions to be called for different lifetime events of each async operation.

const asyncHooks = require('async_hooks')


These functions will be fired based on the lifecycle event of the handler objects.

Read more on Async Hooks, or check the work-in-progress documentation.

Introducing the N-API

The N-API is an API for building native addons. It is independent of the underlying JavaScript runtime and is maintained as part of Node.js itself. The goal of this project is to keep the Application Binary Interface (ABI) stable across different Node.js versions.

The purpose of N-API is to separate add-ons from changes in the underlying JavaScript engine so that native add-ons can run with different Node.js versions without recompilation.

Read more on the N-API.

Buffer security improvements in Node 8

Before Node.js version 8, Buffers allocated using the new Buffer(Number) constructor did not initialize the memory space with zeros. As a result, new Buffer instances could contain sensitive information, leading to security problems.

While it was an intentional decision to boost the performance of new Buffer creation, for most of us, it was not the intended use. Because of this, starting with Node.js 8, Buffers allocated using new Buffer(Number) or Buffer(Number) will be automatically filled with zeros.

Are you looking for help with migrating a large-scale application to a newer Node.js version? Ask our experts.

Upgrade V8 to 5.8: Preparing for TurboFan & Ingnition

With Node.js Version 8, the underlying V8 JavaScript engine gets updated as well.

The biggest change it brings to Node.js users is that it will make possible the introduction of TurboFan and Ignition in V8 5.9. Ignition is V8’s interpreter, while TurboFan is the optimizing compiler.

“The combined Ignition and TurboFan pipeline has been in development for almost 3½ years. It represents the culmination of the collective insight that the V8 team has gleaned from measuring real-world JavaScript performance and carefully considering the shortcomings of Full-codegen and Crankshaft. It is a foundation with which we will be able to continue to optimize the entirety of the JavaScript language for years to come.” – Daniel Clifford and the V8 team

Currently (well, with V8 versions older than 5.6, so anything below Node.js version 8) this is how the V8 compilation pipeline looks

Node.js Version 8 - V8 old pipeline
Photo credit: Benedikt Meurer

The biggest issue with this pipeline is that new language features must be implemented in different parts of the pipeline, adding a lot of extra development work.

This is how the simplified pipeline looks, without the FullCode Generator and the Crankshaft:

Node.js Version 8 - V8 new pipeline
Photo credit: Benedikt Meurer

This new pipeline significantly reduces the technical debt of the V8 team, and enables a lot of improvements which were impossible previously.

Read more on TurboFan and Ignition and the TurboFan Inlining Heuristics

Upgrade npm to 5.0.0

The new Node.js 8 release also ships with npm 5 – the newest version of the npm CLI.

Highlights of this new npm release:

  • A new, standardized lockfile feature meant for cross-package-manager compatibility (package-lock.json), and a new format and semantics for shrinkwrap,
  • --save is no longer necessary as all installs will be saved by default,
  • node-gyp now supports node-gyp.cmd on Windows,
  • new publishes will now include both sha512 and sha1 checksums.

Other notable changes in Node.js Version 8


  • Buffer methods now accept Uint8Array as input

Child Process

  • Argument and kill signal validations have been improved
  • Child Process methods accept Uint8Array as input


  • Error events emitted when using console methods are now suppressed


  • Native Promise instances are now Domain aware

File System

  • The utility class fs.SyncWriteStream has been deprecated
  • The deprecated string interface has been removed


  • Outgoing Cookie headers are concatenated into a single string
  • The httpResponse.writeHeader() method has been deprecated


  • Stream now supports destroy() and _destroy() APIs


  • The rejectUnauthorized option now defaults to true


  • The WHATWG URL implementation is now a fully-supported Node.js API

Next Up with Node.js version 8

Node.js version 8 surprises us with a lot of interesting improvements, including the Async Hooks API which is hard to grasp with the current (but ever evolving) state of it’s documentation. We’ll start playing with the new release ASAP, and get back to you with more detailed explanations of these features soon.

If you have any questions in the meantime, please put them in the comments section below.

Share this post



Learn more at

Node.js Experts