Features & Usage #
- Prefix-only core modules
- Auto reload when change
- Native fetch API
- Experimental WebStreams API
- Additional array methods
Prefix-only core modules #
const os = require('node:os');
const path = require('node:path');
Auto reload when change #
1node --watch index.js
Native fetch API #
const res = await fetch('https://nodejs.org/api/documentation.json');
if (res.ok) {
const data = await res.json();
console.log(data);
}
Experimental WebStreams API #
Node.js now exposes the experimental implementation of the WebStream API on the global scope. This means the following APIs are now globally available:
- ReadableStream, ReadableStreamDefaultReader, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableByteStreamController, ReadableStreamDefaultController, TransformStream, TransformStreamDefaultController, WritableStream, WritableStreamDefaultWriter, WritableStreamDefaultController, ByteLengthQueuingStrategy, CountQueuingStrategy, TextEncoderStream, TextDecoderStream, CompressionStream, DecompressionStream
Array methods #
- findLast()
- findLastIndex()
- Intl.Locate
Examples: #
const inputArray = [{v:1}, {v:2}, {v:3}, {v:4}, {v:5}];
inputArray.findLast((element) => element.v % 2 === 0);
// → {v:4}
inputArray.findLast((element) => element.v % 7 === 0);
// → undefined
inputArray.findLastIndex((element) => element.v % 2 === 0);
// → 3
inputArray.findLastIndex((element) => element.v % 7 === 0);
// → -1