What’s New in Node.js 10 LTS? Key Features, Deprecations, and Experimental APIs
Node.js 10 LTS introduces major updates such as native HTTP/2 support, BigInt, recursive directory creation, CLI flag auto‑completion, Windows installer improvements, V8‑based code coverage, deprecated Buffer constructors, and experimental Worker Threads, while also upgrading OpenSSL and adding PEM‑level encryption.
Preface
After more than a year of development, Node.js 10 has finally entered LTS. This article outlines the noteworthy features.
LTS stands for Long Term Support, a reliable version for production environments.
The Alibaba Cloud Alinode team has quickly added support for the new version; updating to alinode-v4.5.0 lets developers using the Node.js performance platform enjoy the new features.
See the documentation for the detailed version mapping.
TLDR, main keywords:
HTTP/2 BigInt Window installer optimization– solves native module compilation issues Work Threads – experimental API new Buffer() – constructor API fully deprecated
New Features
The following new features are provided by default in Node.js 10 LTS without any flags.
HTTP/2
Native support for HTTP/2 brings more efficient network utilization, header compression, multiplexed streams, and Server Push, enabling better user experiences especially for first‑page static asset optimization.
BigInt
JavaScript’s Number type is limited to safe integers between -2^53 and 2^53 and cannot precisely represent many decimals. The TC39 proposal BigInt (Stage 3) is now partially implemented in Node.js 10, allowing precise handling of large integers.
Recursive fs.mkdir and fs.mkdirSync
Previously these APIs mirrored the Linux mkdir command but lacked the -p recursive option, requiring developers to use external modules like mkdirp. The new recursive option adds native recursive directory creation:
fs.mkdirSync('/home/admin/aaa/bbb/ccc', { recursive: true });CLI Flag Auto‑Completion
Node’s command‑line flags can now be auto‑completed in Bash. Enable it with:
$ node --completion-bash > node_bash_completion
$ source node_bash_completionAfter sourcing, typing node -- and pressing TAB will suggest available flags. Implemented in PR 20713.
Windows Installer Optimization
The MSI installer now includes an optional component “Install Node.js native compilation toolset”, greatly reducing the difficulty of compiling native modules on Windows and lowering the entry barrier for Windows developers.
Code Coverage
Node now exposes V8’s native coverage capabilities via the NODE_V8_COVERAGE environment variable, simplifying high‑quality test coverage collection without the overhead of external tools like Istanbul.
Deprecated Features
The following APIs are permanently deprecated in Node.js 10 LTS; projects should migrate before upgrading.
new Buffer()
The direct Buffer constructor is removed. Use the safer alternatives:
Buffer.from() Buffer.alloc() Buffer.allocUnsafe()Experimental APIs
These APIs are at stability 1: Experimental and may change or be removed. Do not use them in production.
fs.promises
Promise‑based versions of all fs methods are available under fs.promises. Example usage:
(async () => {
const fs = require('fs');
const { promisify } = require('util');
const readFile = promisify(fs.readFile);
let content = await readFile('package.json');
console.log(content.toString());
const mz = require('mz');
content = await mz.fs.readFile('package.json');
console.log(content.toString());
const fsPromise = require('fs').promises;
content = await fsPromise.readFile('package.json');
console.log(content.toString());
})();Worker Threads
The highly requested Worker Threads API is introduced as an experimental feature (requires the --experimental-worker flag) to improve performance of CPU‑intensive tasks.
const { Worker, isMainThread, parentPort, workerData } = require('worker_threads');
if (isMainThread) {
module.exports = async function parseJSAsync(script) {
return new Promise((resolve, reject) => {
const worker = new Worker(__filename, { workerData: script });
worker.on('message', resolve);
worker.on('error', reject);
worker.on('exit', (code) => {
if (code !== 0) reject(new Error(`Worker stopped with exit code ${code}`));
});
});
};
} else {
const { parse } = require('some-js-parsing-library');
const script = workerData;
parentPort.postMessage(parse(script));
}This API is still being evaluated by the core team; feedback is welcome.
Other Minor Updates
These items may be less relevant to most developers but are listed for completeness.
OpenSSL 1.1.0i
Node now supports [email protected] , which adds ChaCha20‑Poly1305 encryption.
PEM‑Level Encryption Support
Node now supports PEM‑level encryption as defined in RFC 1421, a format originally used for secure email and now widely adopted.
References
What’s New to LTS with Node.js 10 LTS
Node.js ChangeLog
Rethinking JavaScript Test Coverage: https://medium.com/the-node-js-collection/rethinking-javascript-test-coverage-5726fb272949
coverage: expose native V8 coverage by bcoe · Pull Request #22527 · nodejs/node
Node.js Buffer documentation: https://nodejs.org/api/buffer.html#buffer_buffer_from_buffer_alloc_and_buffer_allocunsafe
ChaCha20‑Poly1305: https://tools.ietf.org/html/rfc7539
RFC 1421: https://tools.ietf.org/html/rfc1421
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Node Underground
No language is immortal—Node.js isn’t either—but thoughtful reflection is priceless. This underground community for Node.js enthusiasts was started by Taobao’s Front‑End Team (FED) to share our original insights and viewpoints from working with Node.js. Follow us. BTW, we’re hiring.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
