What Is New in Node.js 14?
| Category | Change |
|---|---|
| New Features | Optional chaining (?.) and nullish coalescing (??) operators |
| New Features | Diagnostic reports: stable API for process state snapshots |
| New Features | Experimental async local storage (AsyncLocalStorage) |
| New Features | WASI (WebAssembly System Interface) experimental support |
| Improvements | V8 8.0 -- optional chaining, nullish coalescing |
| Improvements | Streams: more consistent error handling |
| Improvements | fs.promises API moved from experimental to stable |
| Security | OpenSSL 1.1.1g |
Optional Chaining and Nullish Coalescing -- Finally Native
Two of the most requested JavaScript features land natively in Node.js 14 via V8 8.0. Optional chaining (?.) short-circuits property access on null/undefined. Nullish coalescing (??) provides a default only when the left side is null or undefined (unlike || which also triggers on 0 or "").
const city = user?.address?.city ?? 'Unknown';
const port = config.port ?? 3000; // 0 is a valid port, ?? handles that correctly
Previously these required Babel transforms. In Node.js 14 they run natively, reducing transpilation overhead for server-side code.
AsyncLocalStorage -- Request-Scoped Context Without Parameter Passing
AsyncLocalStorage lets you store and retrieve values scoped to an async call tree -- useful for request IDs, user context, logging correlation, and tracing without threading values through every function call.
import { AsyncLocalStorage } from 'node:async_hooks';
const storage = new AsyncLocalStorage();
app.use((req, res, next) => {
storage.run({ requestId: req.id }, next);
});
function log(msg) {
const ctx = storage.getStore();
console.log(`[${ctx?.requestId}] ${msg}`);
}
OpenTelemetry, Datadog APM, and many tracing libraries use this API internally. In v14 it's experimental but widely adopted.
fs.promises Now Stable
The fs.promises API (or import { promises as fs } from 'node:fs') graduates from experimental to stable. All async file operations are available as native promises without callbacks.
import { readFile, writeFile } from 'node:fs/promises';
const content = await readFile('./config.json', 'utf8');
const data = JSON.parse(content);
Diagnostic Reports
The diagnostic report API is now stable. You can generate a JSON snapshot of the process state (heap, handles, libuv, environment variables) on demand or on crash -- invaluable for debugging production issues in environments where you cannot attach a debugger.
process.report.writeReport('./crash-report.json');
// or trigger on signal:
node --report-on-signal --report-signal=SIGUSR2 server.js
FAQ
Is Node.js 14 an LTS release?
Yes. Node.js 14 (codename "Fermium") was an LTS release with active support ending April 2023 and security support ending April 2023. It is fully end-of-life.
Can I use optional chaining with TypeScript in Node.js 14?
Yes. TypeScript has supported ?. since v3.7. When targeting Node.js 14, you can set "target": "ES2020" in tsconfig.json to emit native optional chaining.
Is AsyncLocalStorage production-safe in Node.js 14?
It works well in practice, but the API was officially experimental in v14. It stabilizes fully in Node.js 16. For production usage in v14, include process isolation tests and monitor for async context propagation edge cases.
What is WASI and should I use it in Node.js 14?
WASI (WebAssembly System Interface) lets WASM modules access file system and network resources. In Node.js 14 it is experimental and the API changes across versions. Use it for prototyping only.
Does fs.promises support streaming?
Not directly -- fs.promises is for file reads/writes as resolved data. For streaming, use fs.createReadStream() and fs.createWriteStream(), which return traditional Node.js streams.