Release of the server-side JavaScript platform Node.js 16.0

The release of Node.js 16.0 has taken place, a platform for running network applications in JavaScript. Node.js 16.0 is categorized under long-term support branches, but this status will only be assigned in October after stabilization. Support for Node.js 16.0 will continue until April 2023. Maintenance for the previous LTS branch Node.js 14.0 will last until April 2023, and for the earlier LTS branch 12.0 until April 2022. Maintenance for LTS branch 10.0 will end in 10 days.

Key Improvements:

  • The V8 engine has been updated to version 9.0 (version 8.6 was used in Node.js 15), enabling features in Node.js 16 such as the 'indices' property for regular expressions (which includes an array with the start and end positions of match groups), the Atomics.waitAsync method (an asynchronous version of Atomics.wait), and support for using the await keyword at the top level in modules. Function calls have been accelerated in situations where the number of passed arguments does not match the parameters defined in the function.
  • The Timers Promises API has been stabilized, providing an alternative set of functions for working with timers that return Promise objects, allowing the use of util.promisify() to be avoided. import { setTimeout } from 'timers/promises'; async function run() { await setTimeout(5000); console.log('Hello, World!'); } run();
  • An experimental implementation of the Web Crypto API has been added, designed for performing basic cryptographic operations on the web application side, such as manipulating cryptographic hashes, generating and verifying digital signatures, encoding and decoding data using various encryption methods, and generating cryptographically secure random numbers. The API also includes functions for key generation and management.
  • N-API (the API for add-on development) has been updated to version 8.
  • The transition to the new version of the package manager NPM 7.10 has been completed.
  • The implementation of the AbortController class, based on the Web API AbortController, has been stabilized, allowing for the cancellation of signals in selected Promise-based APIs.
  • Support for the third version of the Source Map format has been stabilized, used to map generated, processed, or bundled modules to the original source code.
  • To maintain compatibility with outdated Web APIs, methods buffer.atob(data) and buffer.btoa(data) have been added.
  • The assembly process for new Apple devices equipped with the M1 ARM chip has begun.
  • On the Linux platform, the requirements for the compiler version have been raised to GCC 8.3.

Note that the Node.js platform can be used for both server-side maintenance of web applications and for creating standard client and server network programs. A large collection of modules has been prepared to extend the functionality of Node.js applications, which includes modules with implementations servers and clients for HTTP, SMTP, XMPP, DNS, FTP, IMAP, POP3, modules for integration with various web frameworks, WebSocket and Ajax handlers, connectors to databases (MySQL, PostgreSQL, SQLite, MongoDB), templating engines, CSS engines, implementations of cryptographic algorithms and authorization systems (OAuth), XML parsers.

To handle a large number of parallel requests, Node.js utilizes an asynchronous code execution model based on event-driven non-blocking I/O and the definition of callback handlers. Multiplexing methods such as epoll, kqueue, /dev/poll, and select are supported for connection multiplexing. The libuv library is used for connection multiplexing, which is a wrapper around libev on Unix systems and IOCP on Windows. The libeio library is employed to create a thread pool, while c-ares is integrated for non-blocking DNS requests. All blocking system calls are executed within the thread pool, and like signal handlers, they pass their results back through an unnamed pipe. JavaScript code execution is ensured through the use of the V8 engine developed by Google (additionally, Microsoft develops a version of Node.js with the Chakra-Core engine).

Essentially, Node.js is similar to the Perl AnyEvent, Ruby Event Machine, Python Twisted frameworks, and the event handling implementation in Tcl, but the event loop in Node.js is abstracted away from the developer and resembles the event processing in a web application running in a browser. When developing applications for Node.js, it is crucial to consider the specifics of event-driven programming. For example, instead of executing "var result = db.query('select...');" and waiting for its completion before processing the results, Node.js employs asynchronous execution, meaning the code is transformed into "db.query('select...', function (result) {process result});" allowing control to pass immediately to the subsequent code, with the query results processed as data arrives.

Additionally, it is worth noting that Deno, a company founded by the creator of Node.js to develop the next-generation Deno platform, has secured $4.9 million in investments. Deno serves a similar purpose to Node.js but aims to correct the conceptual mistakes made in the architecture of Node.js and provide users with a more secure environment. It’s noted that Deno’s business solutions will be built on completely open products, while the Open Core model that segments certain paid features is viewed as unacceptable for the Deno platform.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster