Web Development

What’s New & Exciting in Node.js V.8 for Developers?

“Carbon” is the codename given to the Node.js 8 that entered the LTS in October and is expected to remain until December 2019. Also, there is a probability of Node.js version 6 to enter its maintenance mode after April 2018. The opportunities for developers are enormous as recently included features will make things fast, disposing of the unnecessary delays.

1. npm 5 Integration

 

The Node.js 8 has been incorporated with npm 5, which is presently accessible by default for the developers.

What does this Mean?

  • A lockfile feature i.e. package-lock.json is accessible for cross-package-manager compatibility.
  • You don’t need to wait for network availability and retry again for network demands.
  • There is no compelling reason to save your work as installs will be saved automatically.
  • Both the checksums, shal1 and sha512 are incorporated.
  • Packages will be introduced from the most recent registry you change to.

 

2. TurboFan and Ignition

This is one of the most eye-catching improvements in Node.js 8 that’ll help lessen memory consumption and speed up the startup. Ignition is the mediator while TurboFan is the compiler.

Prior, V8 compilation pipeline resembled the one shown below, which loaded developers with generous work because of the usage of new language features in various segments of the pipeline.

But, the implementation procedure has now been enhanced with this version release as Crankshaft and FullCode Generator has been dumped totally influencing the new pipeline to resemble. The greatest issue with this pipeline is that new language features must be executed in various parts of the pipeline, including a ton of additional development work.

 

3. N-API Consideration

 

Utilized for building local add-ons, this API is currently incorporated into Node.js 8 with the intent to isolate add-ons from periodic changes in the underlying JavaScript engine. This won’t just help in utilizing add-ons for numerous Nide.js versions without compiling them on numerous occasions but in addition to keeping Application Binary Interface (ABI) stable. It will be kept up separately as a part of Node.js, far from the center JavaScript engine.

The aim of N-API is to isolate add-ons from changes in the underlying JavaScript engine so local add-ons can keep running with various Node.js versions without recompilation.

 

4. Async Hooks API

In the past known as async_wrap, the API has been changed to async_hooks for Node.js 8.0.0. This API empowers web application developers to track event loops and asynchronous requests along with handling the complete procedure. It is as yet a test module with incomplete documentation; thus, it is recommended to utilize it carefully.

 

5. Buffer Improvements

The security bugs were experienced when new Buffer constructor was utilized as it didn’t introduce the default memory space to zero-which made the new Buffer cases vulnerable to the data leak. This issue, in any case, is presently taken care of in Node.js 8 with buffers allocated utilizing new Buffer(Number), or Buffer(Number) will get a default zero value.

 

6. URL Implementation

In Node.js 8, WHATWG URL implementation is no more an experimental API, rather it is a completely supported Node.js API. This implies code documents that contain URLs would now be able to be shared crosswise over development environment effortlessly.

 

7. Console Fixes

Huge changes have been acquainted with prevent undesired bugs and errors while composing console outputs. The new Node.js version is able of suppressing error events that were discharged unwillingly utilizing console strategies.

Aside from the ones mentioned above, there are a couple of more changes including child process methods, string interface removal, domain awareness, debugger variations and increasingly that have been done to enhance the performance and to diminish the pointless development load.

 


 

Other notable changes in Node.js Version 8

 

Child Process

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

 

Domains

  • Native Promise instances are now Domain aware

 

HTTP

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

 

TLS

  • The rejectUnauthorized option now defaults to true

 

Buffer

  • Buffer methods now accept Uint8Array as input

 

Console

  • Error events emitted when using console methods are now suppressed

 

Stream

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

 


 

Final Words

Node.js is known for its single string operations equipped for running a huge number of parallel functions. The Node.js 8.0.0 is all the more capable and refined. You can create adaptable networking apps with less time and efforts. This time, the community has worked extremely hard in upgrading its performance and security to make it more robust than ever.