What Is New in Node.js 11?
| Category | Change |
|---|---|
| New Features | V8 7.0 -- Array.prototype.flat/flatMap, Object.fromEntries |
| New Features | Unhandled rejections default changed to warn-with-error-code mode |
| Improvements | Readable streams: async iteration support |
| Improvements | Worker threads (experimental) |
| Improvements | ICU full-icu by default on all platforms |
| Improvements | http: removed legacy URL (req.url now always a string) |
| Security | OpenSSL 1.1.0j |
Array.flat(), flatMap(), and Object.fromEntries()
Three often-requested array and object utilities land natively in Node.js 11 via V8 7.0.
// flat() -- flatten nested arrays
[1, [2, [3]]].flat(); // [1, 2, [3]]
[1, [2, [3]]].flat(Infinity); // [1, 2, 3]
// flatMap() -- map + one-level flatten in one pass
['hello world', 'foo'].flatMap(s => s.split(' ')); // ['hello', 'world', 'foo']
// Object.fromEntries() -- reverse of Object.entries()
const map = new Map([['a', 1], ['b', 2]]);
Object.fromEntries(map); // { a: 1, b: 2 }
Async Iteration for Readable Streams
Node.js 11 adds for await...of support for readable streams. This lets you consume streaming data with clean async iteration instead of event listeners.
import { createReadStream } from 'node:fs';
const stream = createReadStream('./large.csv', { encoding: 'utf8' });
for await (const chunk of stream) {
processChunk(chunk);
}
Backpressure is still handled automatically. This is a more readable pattern for sequential stream processing.
Full ICU by Default
Node.js 11 bundles full ICU data on all platforms by default. Prior to this, the default build only included a small subset of locales. Full ICU means Intl APIs (date formatting, number formatting, collation) work correctly for all locales without building a custom Node.js binary.
FAQ
Is Node.js 11 an LTS release?
No. Node.js 11 is a Current release that reached end-of-life in June 2019. The concurrent LTS was Node.js 10.
Do for await...of loops on streams handle errors?
Yes, but you need a try/catch around the loop. If the stream emits an error, the for await loop throws, which you catch normally.
Is Object.fromEntries() available in TypeScript targeting Node.js 11?
Set "lib": ["ES2019"] or later in tsconfig.json and TypeScript will include the type definition for Object.fromEntries().
What happened to unhandled rejections in Node.js 11?
The default mode changed to output a deprecation warning and exit with code 1, signaling that future versions would make this a hard crash. Node.js 15 completes that transition.
Does full ICU significantly increase the Node.js binary size?
Yes, by roughly 20-25 MB. If binary size is critical (embedded systems, containers), you can build Node.js with --with-intl=small-icu to restore the smaller footprint.