Share this article Return

Facebook Twitter Linkedin Pinterest





Version 8 is the newest release of Node, and it’s packed with features. Popular by the code name Carbon, Node.js v8 was original to be released in late April but was delayed in favor of the release of Ignition and TurboFan for the V8 JavaScript Engine. Node 8 will use V8 5.8 with ABI compatible with V8 6.0. This will provide better performance, a stronger support contract with V8, and a smaller delta between Node 8 and 9 as indicated by the Node.js Collection. Node.js will go into Long Term Support (LTS) in October 2017 and will be maintained till December 31st, 2019.

The new improvements and features of this release create the best workflow for Node.js developers to date. Highlighted updates and features include adding Node.js API for native module developers, Async_hooks, JS bindings for the inspector, zero-filling Buffers, util.promisify and more.





"Those who need stability and have complex production environments (i.e. medium and large enterprises) should wait until Node.js 8 goes into LTS before upgrading it for production."









Now, we'll go through the most important features and improvements of the new Node.js 8 release.





1. Async Hooks API:

The Async Hooks (formerly known as AsyncWrap) API has got a notable upgrade to the latest version. This 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.

Formerly, a package called ‘co’ was used to utilize generators to write better asynchronous code to create a more readable control flow. Now, this control flow can be implemented without the need of a third-party library.





2. The Advantage of Having N-API

This API will be Application Binary Interface (ABI) stable across versions of Node.js. It is intended to insulate Addons from changes in the underlying JavaScript engine and allow modules compiled for one version to run on later versions of Node.js without recompilation. The API is currently experimental. It is independent of the underlying JavaScript runtime (ex V8) and is maintained as part of Node.js itself.





util.promisify

util.promisify() allows developers to wrap callback APIs to return Promises. The function works with little overhead and follows a standard API.





JS Bindings for the Inspector

The new inspector core module enables developers to leverage the debug protocol used by the Chrome inspector in order to inspect currently running JavaScript code.





3. Buffer security improvements in Node 8

There are two numbers, the first the zero filling Buffer and the second is a new Buffer. Both are added by default. However, earlier, the memory space was not initialized with zero because of which one had to face security issues as the Buffer instance had sensitive information.

The upgrading of the new version has enabled people to secure their privacy. However, it is advisable for the Node.js 8 users to first be aware of the risks factor involved in function and only then use to avoid the leakage of secure information. Though, there is an also a problem that you have to take performance hits. But it is better to move on to buffer.allocUnsafe ().





4. 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 have 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-code gen 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."

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





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.

Simplified pipeline looks, without the FullCode Generator :

Photo credit: Benedikt Meurer





Other notable Addition in Node.js Version 8





Buffer

Buffer methods now accept Uint8Array as input





Child Process

Argument and kill signal validations have been improved

Methods accept Uint8Array as input





Console

Error events emitted when using console methods are now suppressed





Domains

Native Promise instances are now Domain aware





Errors

Node has started assigning static error codes to errors generated





File System

The utility class fs.SyncWriteStream has been deprecated

has been deprecated The deprecated fs.read() string interface has been removed





HTTP

Improved support for userland implemented Agents

implemented Agents Outgoing Cookie headers are concatenated into a single string

The httpResponse.writeHeader() method has been deprecated

method has been deprecated New methods for accessing HTTP headers have been added to OutgoingMessage





Lib

The legacy linkedlist module has been removed.





REPL

REPL magic mode has been removed





Src

The —-debug command-line argument has been removed





Stream

Stream now supports destroy() and _destroy() APIs

and Stream now supports the final() API





TLS

The rejectUnauthorized option now defaults to true





Util

Symbol keys are now displayed by default when using util.inspect()

toJSON errors will be thrown when formatting %j

errors will be thrown when formatting Convert inspect.styles and inspect.colors to prototype-less objects





Zlib

Support Uint8Array in Zlib convenience methods

in Zlib convenience methods Zlib errors now use RangeErrorand TypeError consistently





URL:

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





Conclusion:-

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 its documentation. Node.js is proud to associate with world renowned companies including Microsoft, Yahoo, Netflix, LinkedIn etc as its esteemed clients.

Those were some of the best features that come with NodeJS latest version which will assist in fulfilling various Single Page Application Development . Node.js just released it's latest update v8.1.1, and we will get back to you with more detailed explanations of these features soon.





Also refer Comparison Between: AngularJS Vs Node JS

About The Author Amit Khirale My passion lies in empowering other businesses on how to take their complex processes, business & operations online, using modern technologies for web & mobile application development which are custom, scalable and reliable.

Share this article

Facebook Twitter Linkedin Pinterest