Node.js 5!


It’s this time of year again, Node.js 5.0.0 has been released and it the next stable release of Node.js.

Now, Node.js 4.x.x is still the goto release if you have large roll outs of Node.js within your organisation. 4.x.x will still be receiving security and general matenance updates for the duration of its LTS life-cycle, However if you want the latest and greatest features then 5.0.0 will be more than stable.

What is new?

v8:

  • Implements the spread operator, see.
\[...iterableObj, 4, 5, 6\]
  • Implements new.target, see.
function Foo() {    
  if (!new.target) throw "Foo() must be called with new";  
  console.log("Foo instantiated with new");  
}

npm:

console:

  • console.time() - resolution now has 3 decimals of added accuracy.

fs:

  • fs.readFile fs.writeFile fs.appendFile These all now accept a file descriptor as their first argument.

http:

  • No more duplicates of the following headers: Retry-After, ETag, Last-Modified, Server, Age, Expires.
  • Http methods and header names must conform to RFC 2616 “token” rules — /^[a-zA-Z0-9_!#$%&'*+.^`|~-]+$/ or a TypeError.
  • OutgoingMessage#setTimeout() - must be a function or a TypeError is thrown (James M Snell)

tls:

  • ALPN support has been added.
  • createSecurePair() - can now be passed a TLS option.

zlib:

  • Now throws on unexpected end of files.

What is deprecated?

internal:

  • _linklist
  • require.paths
  • require.registerExtension()

buffer:

  • raw and raws have been removed as encoding types.

util:

  • .p()

What has changed?

fs:

  • fs.readFile fs.read Some errors are now returned in the callback instead of being thrown.

util:

  • inherits has been updated to work with ES6 classes, however the prototype has been rearranged and could be a breaking change for some consumers.

v8:

  • 4.6.85.25 from 4.5.103.35

timers:

  • setTimeout().unref() - Attempt to reuse the timer handle internally; This fixes a long-standing known issue where unrefed timers would perviously hold beforeExit open.

tls:

.connect() - The default minimum DH key size is now 1024 bits and a warning is shown when DH key size is less than 2048 bits. This a security consideration to prevent "logjam" attacks. A new minDHSize TLS option can be used to override the default

More

Checkout the whole changelog here: https://github.com/nodejs/node/blob/v5.0.0/CHANGELOG.md

At YLD! for any production code we will continue using 4.x.x, however for our own projects we will be playing around with 5.x.x

Written by Tom Gallacher— Staff Engineer at YLD.

Interested in Node? Read more about it:


Written by YLDNovember 1st, 2015


Share this article