Node.JS 8.0

Node.JS 8.0 New LTS Release with Advanced Native Module Features

The much-awaited release Node.js 8.0 has been finally released with the codename ‘Carbon’. This Node.js 8.0 version will provide support for Long Term Support (LTS) from October 2017. The advanced new release of Node.js has a plenty of exciting features that every developer are looking forward to testing.

This new improving feature has created the best workflow for Node.js developers by highlighting the major updates and improvements which include Node.js API for the native module, JS binding, Async hooks, zero filling Buffers as well as utility promisify etc.

Node JS 8.0 LTS release has the primary focus on stability & security so as to offer best valuable stability during up-gradation using Node.js in the enterprise.


Node.JS 8.0 New LTS Advanced Features:


1. Introducing Node.JS 8.0 with npm 5 :


The npm 5 presence in the Node.JS 8.0 is one of the amazing features which makes Node.JS platform different from other technologies. Npm 5 gives the amazing experience for the network mobile app developer using Node.js 8 without any hindrance.

The major changes in node.js 8.0 npm will install current registry which the developer chooses. When there is no npm-shrinkwrap.json still the package lock.json automatically gets develop which is the most important feature during no internet connectivity as well as no need of retry network request.

Npm, Inc comes with the new release of npm as the latest version 5.0 npm client CLI which included in the latest Nodejs 8.0 LTS. The package management which includes package installation, as well as version updates, has become 5 times faster as compared to the previous version.

The lock files ensure installations among development environments consistently with the self-healing cache which offers support for automatic error recovery that protects from corrupted downloads. Npm 5 introduces the smart SHA-512 code verification. Node.js 8 with npm@5 makes the modular software development environment faster as well as easier for the software developers.


It is the world largest performance & improvement said Isaac Z. Schlueter, CEO of npm, Inc.


Highlights of New npm 5 Release:


Breaking Changes:

  • The old existing npm caches will not be used & you have to redownload the cached packages. It offers no tool to reuse old caches
  • The important packages such as npm install ./packages/subdir will create a symlink rather than creating a regular installation. Directories are symlink & file://path/to/tarball.tgz will not change except the directories.
  • The package, package-lock.json automatically get created when npm-shrinkwrap.json exists. Npm –-save by default now in Nodejs8.
  • Git dependencies provide support for semver using user/repo#semver:^1.2.3 and also prepare scripts having devDependencies installed that helps npm install to run in their directories.


Installer Changes:

  • A standardized new lockfile feature provides compatibility for cross-package-manager (package-lock.json), and also offers new format and semantics for shrinkwrap.
  • –save is not important now. All necessary installation saved by default.
  • To prevent saving use –no-save. Installation is optional & dev deps can be used as -D/–save-dev and -O/–save-optional
  • There is no need of Installing package directory because this process is replace by creating a symlink.
  • prepack and postpack, are the two new master scripts added, that will run on both npm pack and npm publish but do not support on npm install without arguments.


Check More Information About npm 5 click here


2. WHATWG URL Parser : Better Stability & Implementation


Node.js 8.0 provides the better implementation of WHATWG URL. It is the most interesting feature added in the Node.js version 8. WHATWG URL adds major advantage for node js environment offering matches with URL implementation as well as with API, accessible to all popular web browsers which include Mozilla Firefox, Apple’s Safari as well as Google Chrome etc.

It makes the sharing of code easy accessible for network apps developer across the node js environment by URL implementation. The new advanced version of WHATWG URL parser added to Node.js 8 as an URL API which matches the URL implementation and API with the latest Web Browsers like Chrome, Firefox, as well as Safari. It allows code using URLs sharing among the node js 8 environments.

WHATWG URL parser offers full support for node js 8 version which allows developers to use a URL parser that is full with specifications & more compatible with advanced browsers.



const URL = require('URL').URL;

const myUrl = new URL('/a/path', 'https://example.org/');

WHATWG URL Parser Implementation :

url.hash# : <string>
Gets and sets the fragment portion of the URL.

const { URL } = require('url');
const myURL = new URL('https://example.org/foo#bar');
// Prints #bar

myURL.hash = 'baz';
// Prints https://example.org/foo#baz

//url.host# : <string>
//Gets and sets the host portion of the URL.

const { URL } = require('url');
const myURL = new URL('https://example.org:81/foo');
// Prints example.org:81

myURL.host = 'example.com:82';
// Prints https://example.com:82/foo

//url.href# : <string>
//Gets and sets the serialized URL.

const { URL } = require('url');
const myURL = new URL('https://example.org/foo');
// Prints https://example.org/foo

myURL.href = 'https://example.com/bar';
// Prints https://example.com/bar


Check More Information About WHATWG URL click here


3. TurboFan and Ignition: The Exciting Upgrade V8 to 5.8


The Occurrence of Ignition and the TurboFan is the major changes added in the latest node js 8.0. TurboFan works as an optimizing compiler and the Ignition known for V8 interpreter.

Ignition and TurboFan combination acts as a pipeline for node js development race which resolves a large number of technical issues. In Node.js Version 8, the best V8 JavaScript engine offers the consistent update.

This turbofan & ignition pipeline adds new language features that must be implemented in different parts of the pipeline which adds extra work for application development.

Check More Information About V8 click here


4. Welcome V8 5.8 : JavaScript Runtime


Node.js 8.0.0 offers one of the best combination by working with V8 5.8 which is a significant update to JavaScript runtime. It includes major improvements with performance as well as developer facing APIs.

It is the most significant update for node js developers that V8 5.8 offers forwards ABI compatibility in V8 5.9 as well as with V8 6.0. Hence, it will ensure high stability for the Node.js native addon environment.

The V8 5.8 engine promises to setup pending transition with the new TurboFan + Ignition compiler pipeline. It provides significant changes in performance optimizations for all Node.js applications.

This significant version V8 provides TurboFan and Ignition which will be enabled by default for the first time in V8 5.9. This new compiler pipeline represents the highlighting change in the Node.js 8.


5. Node.js API (N-API): Native Modular Ecosystem


The new node js 8 API comes with advanced enhancement of native addons for node js developer over existing native abstractions for node.js(nan). It allows native addons to get compile in a system which used for multiple version of node js.

It introduces a new virtual machine as Application Binary Interface ABI which makes the native addons to work against multiple versions of the V8 Javascript runtime as well as with Microsoft’s Chakra-Core runtime too.

Node.JS 8.0 comes with the initial version of N-API which is an API for building native addons. N-API is an independent of JavaScript runtime V8 which is define as part of Node.js itself. It offers easier upgrades to new node js versions as well as less install time dependencies on compilers as a long term benefit for developers.

One another important features added as VM neutrality which allows additional innovation in Javascript engine within the Node.js environment. N-API was define as an experimental feature in v8.0 so as to separate add-ons from changes in the JavaScript engine. It will define the platform for native add-ons to run with different Node.js versions.


6. Introducing the Async Hooks API


The advance async_hooks module is also known as async_wrap comes with a significant upgrade in 8.0.0.
This async hooks API allows developers to monitor the operation of the Node.js such as event looping, tracking asynchronous requests as well as handling through their complete lifecycle.

Version 8 offers advanced AsyncHooks API that will allow better implementation of Application Performance Management (APM). It will improve the data as well as maintain the stability of the APM implementations across all versions.

The API supports the callbacks registration so as to track the lifetime of asynchronous resources within a Node.js application. A high level API for AsyncWrap which exposed through process.binding.



const asyncWrap = process.binding('async_wrap');
To assign the hooks call with patch update:
asyncWrap.setupHooks({init, pre, post, destroy});
function init(uid, provider, parentUid, parentHandle) 
{ /* consumer code */ }
function pre(uid) 
{ /* consumer code */ }
function post(uid, didThrow)
{ /* consumer code */ }
function destroy(uid) { /* consumer code */ }

It has currently 4 Hooks:

  • init
  • pre
  • post
  • destroy
  1. this variable helps to handle object using uid argument.
  2. post provides information of executing callback.
  3. init provides extra information about the creation of the handle object.


function init(uid, provider, parentUid, parentHandle) { }

function pre(uid) { } function post(uid, didThrow) { } function destroy(uid) { }


Check more information about Async Hooks clicks here


7. Zero Filing Buffer Security Improvements


Most significant changes made in the Buffer API within the Node.js. It offers the calling of deprecated Buffer(num) constructor with or without the new keyword will return a zero-filled Buffer instance. old versions of Node.js return the uninitialized memory which can contain sensitive data.

A Buffer methods sets introduce to call the Buffer(num) constructor as an alternative so as to address security and usability concerns. Node js 8 introduces the new instances of Buffer(num)known as Zero-filling. it will have a significant impact on performance & stability.

When developer allocates the buffer instances with un-initialized memory then they will move to the Buffer.allocUnsafe(num) API.

Examples of zero-filled and uninitialized Buffer creation in Node.js 8.


// Zero-filled Buffers
const safeBuffer1 = Buffer.alloc(10);
const safeBuffer2 = new Buffer(10);

// Uninitialized Buffer
const unsafeBuffer = Buffer.allocUnsafe(10);


There is no current way to remove the Buffer(num) constructor from Node.js, its continued use is deprecated. The zero-filling Buffer (num) and a new Buffer (num) add by default.

The zero-filling Buffer provides the security and privacy so as to prevent information leaks. Hence, the downside buffer uses folks which will take performance hits & avoided by migrating to buffer.allocUnsafe().

Node.js 8.0 users can use this function when they are aware of its risks and know to avoid those problems. Node.js comes with vital changes in the Buffer API. Buffers allocation can be done by using new Buffer(Number) or Buffer(Number) that can be automatically fill with zeros. It will increase the effect of performance so as to prevent security issues.


8. Pending Deprecations Command Line


Node.Js 8.0 introduces a new –pending-deprecation command-line flag to catch uses of Buffer(num) easily within the application development time as well as within CI within CI testing ecosystem.

It also introduces matching NODE_PENDING_DEPRECATION=1 environment variable which will make nodejs to emit deprecation warning which is a process warning when Buffer(num), as well as other pending potential deprecations, is used.

An example which enables pending deprecations.


$ ./node --pending-deprecation
> Buffer(num)
<Buffer 00>
> (node:2896) [DEP0005] DeprecationWarning: The Buffer() and new Buffer() constructors are not recommended for use due to security and usability concerns. Specially use new Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() construction methods.


9. Promisify : Improved Support for Promises


Node.js 8.0.0 provides a new util.promisify() API which allows standard Node.js callback APIs in a function that returns a Promise.

util.promisify was defined in a version 8 as a utility to make more easy & efficient to use promises with existing Node.js APIs.

An example use of util.promisify() is shown below.


const fs = require('fs');
//file reading

const util = require(‘util’); const readfile = util.promisify(fs.readFile); readfile(‘/some/file’) .then((data) => { /** … **/ }) .catch((err) => { /** … **/ });


It takes the function of all common Node.js callback style & returns a promise function. If you are a user of promises you should read about promisify click here


10. Scalable Network Application with NodeJS 8


Node.js 8 introduces the platform for developing the fast & scalable network application development for mobile app development services.

Nodejs 8 provides the scalability feature which can handle several simultaneous connections offering high amount networking as well as high scalability.

This version 8 provide the great option for the developer who uses V8 and npm5 features, that expect better performance as well as long time support.


11. Console API Changes


The important changes in the console introduce the console.log() & console.error() method which includes other methods available with console module in Node.js.

It allows application output to be direct to stdout, stderr or pipes. When the developer writes console output for any stream would make theNode.js application to crash in the previous node.

Now, with node js 8.0.0 such errors are resolved by making use of console.log() & make the APIs safer. It helps to maintain legacy behavior for errors by using ignore-errors option passed to the Console constructor.

Read : 7 Best JavaScript Frameworks To Learn in 2017

Hope you have liked this article, please feel free to provide any suggestions, comments or query. Also, don’t forget to subscribe us on Youtube. You can also find us on twitter and facebook.

1 thought on “Node.JS 8.0 New LTS Release with Advanced Native Module Features”

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.