What Is New in Node.js 6?
| Category | Change |
|---|---|
| New Features | V8 5.1 -- 93% ES6 coverage, destructuring, default params, rest/spread |
| New Features | npm 3 bundled |
| Improvements | Buffer: new safe constructors (from(), alloc()) |
| Improvements | process.release now includes an LTS property |
| Improvements | Improved error messages for require() failures |
| Improvements | node --inspect (experimental Chrome DevTools) |
| Security | OpenSSL 1.0.2h |
93% ES6 Coverage -- Modern JavaScript Without Transpiling
Node.js 6 ships V8 5.1 with 93% ES2015 (ES6) coverage. This is the release where writing modern JavaScript on the server without Babel becomes practical for most codebases. The key features available without any flag:
- Destructuring assignments (
const { a, b } = obj) - Default parameters (
function fn(x = 0) {}) - Rest parameters and spread operator (
...args) - Template literals
- Arrow functions, classes,
let/const Map,Set,WeakMap,Symbol- Iterators, generators (
function*)
Buffer Safety API
Node.js 6 introduces Buffer.from(), Buffer.alloc(), and Buffer.allocUnsafe() as safe replacements for the new Buffer() constructor. The old constructor had a security vulnerability: passing a number created an uninitialized buffer that could expose internal heap memory.
// Old (insecure -- exposes uninitialized memory)
const buf = new Buffer(1024);
// New safe alternatives
const safe = Buffer.alloc(1024); // zero-filled
const fast = Buffer.allocUnsafe(1024); // faster, uninitialized
const data = Buffer.from('hello', 'utf8'); // from string/array/buffer
Experimental Chrome DevTools Debug Support
Node.js 6 experimentally supports --inspect, enabling Chrome DevTools to connect and debug Node processes. Previously, debugging required the external node-inspector npm package. This built-in integration eventually becomes the standard debugging workflow in later versions.
FAQ
Is Node.js 6 an LTS release?
Yes. Node.js 6 (codename "Boron") was an LTS release with support until April 2019. Fully end-of-life.
Can I use ES6 modules (import/export) in Node.js 6?
No. ESM support was not available until Node.js 12+. Node.js 6 gives you ES6 syntax via CommonJS (require()). Use Babel if you need ESM syntax for isomorphic code.
Does Node.js 6 support Promises natively?
Yes. Promise has been built into V8 (and available in Node.js) since Node.js 0.12. Node.js 6 further improves performance and spec compliance.
Is destructuring in Node.js 6 as performant as property access?
For most patterns, yes. V8 5.1 optimizes common destructuring patterns. Hot paths that destructure inside tight loops benefited from V8 optimizations in later versions (7+).
What does process.release.lts contain?
It contains the codename string of the LTS release (e.g., "Boron") if running an LTS version, or false if not. Useful for scripts that need to behave differently on LTS vs Current releases.