Node.js v10.12.0 was released, yesterday, with notable changes to assert, cli, crypto, fs, and more. However, the Node.js API is still somewhat changing, and as it matures, certain parts are more reliable than others. Hence throughout the Node.js v10.12.0 Documentation are indications of a section’s stability.
List of Node.js v10.12.0 changes which are stable
Improvements to file system in node js
The fs module provides an API for interacting with the file system in a manner closely modeled around standard POSIX functions.
Node.js v10.12.0 adds a recursive option to fs.mkdir and fs.mkdirSync. On setting this option to true, non-existing parent folders will be automatically created.
Crypto Module in node js
The crypto module provides cryptographic functionality that includes a set of wrappers for OpenSSL’s hash, HMAC, cipher, decipher, sign, and verify functions. In Node.js v10.12.0, crypto adds support for PEM-level encryption.
It also supports API asymmetric key pair generation. The new methods crypto.generateKeyPair and crypto.generateKeyPairSync can be used to generate public and private key pairs. The API supports RSA, DSA and EC and a variety of key encodings (both PEM and DER).
Changes to cli in node js
The command line interface in Node.js v10.12.0 has two improvements:
- The options parser now normalizes _ to – in all multi-word command-line flags, e.g. –no_warnings has the same effect as –no-warnings.
- It also includes bash completion for the node binary. Users can generate a bash completion script with run node –completion-bash. The output can be saved to a file which can be sourced to enable completion.
Assert module in node js
Changes have been made to assert. The assert module provides a simple set of assertion tests that can be used to test invariants. It comprises of a strict mode and a legacy mode, although it is recommended to only use strict mode.
In Node.js v10.12.0, the diff output is now improved by sorting object properties when inspecting the values that are compared with each other.
Changes in module in node js
In the Node.js module system, each file is treated as a separate module. Module has also been updated in v10.12.0. It adds module.createRequireFromPath(filename). This new method can be used to create a custom require function that will resolve modules relative to the filename path.
Updates to url in node js
Node.js v10.12.0 adds url.fileURLToPath(url) and url.pathToFileURL(path). These methods can be used to correctly convert between file: URLs and absolute paths.
Changes in Utilities in node js
The util module is primarily designed to support the needs of Node.js’ own internal APIs. The changes in Node.js v10.12.0 include:
- A new sorted option is added to util.inspect(). If set to true, all properties of an object and Set and Map entries will be sorted in the returned string. If set to a function, it is used as a compare function.
- The util.instpect.custom symbol is now defined in the global symbol registry as Symbol.for(‘ nodejs.util.inspect.custom’).
- Support for BigInt numbers in util.format() are also added.
Improvements in V8 API in node js
The V8 module exposes APIs that are specific to the version of V8 built into the Node.js binary. A number of V8 C++ APIs in v10.12.0 have been marked as deprecated since they have been removed in the upstream repository. Replacement APIs are added where necessary.
Improvements to process in node js
The process object is a global that provides information about, and control over, the current Node.js process. Process adds a ‘multipleResolves’ process event that is emitted whenever a Promise is attempted to be resolved multiple times.
Changes in Windows
The Windows msi installer now provides an option to automatically install the tools required to build native modules.