release , a platform for running network applications in JavaScript. At the same time, the stabilization of the previous Node.js 12.x branch has been completed, which has been moved to the long-term support (LTS) release category, with updates released for it over 4 years. Support for the previous LTS branch Node.js 10.0 will continue until April 2021, while support for the earlier LTS branch 8.0 will last until January 2020.
Key :
- The V8 engine has been updated to version , which includes new performance optimization methods, improved object destructuring, reduced memory consumption, and shortened execution preparation time for WebAssembly;
- Full support for internationalization and Unicode based on the libraries is enabled by default (International Components for Unicode), allowing developers to write code that working with various languages and locales. The full-icu module is now installed by default;
- The API has been stabilized , to create multithreaded event loop cycles. The implementation is based on the worker_threads module, which allows running JavaScript code in multiple parallel threads. Stable support for the Workers Threads API has also been backported to the Node.js 12.x LTS branch;
- Platform requirements have been increased. To build, you now need at least macOS 10.11 (Xcode 10 required), AIX 7.2, Ubuntu 16.04, Debian 9, EL 7, Alpine 3.8, Windows 7/2008;
- Improved support for Python 3. When both Python 2 and Python 3 are available on the system, Python 2 is still used, but building is now possible with only Python 3 present on the system;
- The old implementation of the HTTP parser ('--http-parser=legacy') has been removed. Calls and properties such as FSWatcher.prototype.start(), ChildProcess._channel, the open() method in ReadStream and WriteStream objects, request.connection, response.connection, and module.createRequireFromPath() have been removed or deprecated;
- Next update 13.0.1, which quickly fixed several bugs. This includes resolving an issue with npm 6.12.0 issuing warnings about using an unsupported version.
It should be noted that the Node.js platform can be used for both server-side support of web applications and for creating regular client and server network programs. A large , which includes modules for implementing HTTP, SMTP, XMPP, DNS, FTP, IMAP, POP3 servers and clients, modules for integration with various web frameworks, WebSocket and Ajax handlers, connectors to databases (MySQL, PostgreSQL, SQLite, MongoDB), template engines, CSS engines, implementations of cryptographic algorithms and authentication systems (OAuth), XML parsers.
To handle a large number of simultaneous requests, Node.js employs an asynchronous model for executing code, based on event-driven, non-blocking processing and the definition of callback handlers. Multiplexing of connections is supported through methods such as epoll, kqueue, /dev/poll, and select. The library used for multiplexing connections is , which is a layer built on top of in Unix systems and over IOCP in Windows. A thread pool is created using the library , and for performing DNS queries in a non-blocking manner, it integrates . All system calls that could block are executed within the thread pool and then, like signal handlers, pass their results back through an unnamed pipe. Execution of JavaScript code is facilitated by leveraging the engine developed by Google, (additionally, Microsoft is developing a Node.js variant with the Chakra-Core engine).
Essentially, Node.js is similar to frameworks like , , and event handling in Tcl, but the event loop in Node.js is abstracted away from the developer and resembles event handling in a web application running in a browser. When writing applications for Node.js, the specifics of event-driven programming must be considered; for instance, instead of writing 'var result = db.query('select..');' and waiting for it to complete before handling results, in Node.js, the principle of asynchronous execution is used, meaning the code transforms into 'db.query('select..', function (result) {handle result});', where control immediately passes to the next code, and the query result is processed as data arrives.
Source: opennet.ru
