In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the important features of Node.js8 and repair methods of what is the relevant knowledge, the content is detailed and easy to understand, simple and fast operation, with a certain reference value, I believe you read this Node.js8 important features and repair methods of what the article will be rewarded, let's take a look at it.
Async Hooks API introduction
The Async Hooks (formerly known as AsyncWrap) API allows you to get structural trace information about the lifecycle of handle objects.
The message from API informs consumer of the life cycle of all handle objects in Node.js. It tries to solve problems like continuation-local-storage npm package.
If you are using continuation-local-storage, you can use an async hooks called cls-hook instead-it's just not the best time to use async hooks right now, so you need to use it with caution!
How Async Hooks API works in Node.js 8
The registration function of the createHooks function is called by different lifecycle events for each asynchronous operation.
Const asyncHooks = require ('async_hooks') asyncHooks.createHooks ({init, pre, post, destroy})
Learn more about Async Hooks, or check out the documentation for ongoing work. These functions will be triggered selectively based on the lifecycle events of the handler object.
N-API introduction
N-API is the API used to build native plug-ins. It is independent of the underlying JavaScript runtime and is maintained as part of the Node.js itself. The goal is to ensure that the application binary interface (ABI) remains stable between different Node.js versions.
The purpose of N-API is to distinguish between add-ons and changes in the underlying JavaScript engine so that native plug-ins can run different versions of Node.js without recompiling.
Learn more about N-API.
Buffer security improvements in Node.js 8
Prior to the Node.js 8 release, buffers allocated using the new Buffer (Number) constructor did not initialize memory space with ZEROS. As a result, new Buffer instances may contain sensitive information, which can easily lead to security problems.
Although this is a decision to improve the performance of creating a new Buffer, for most people, it is not intended to be used that way. So starting with Node.js 8, Buffers assigned using new Buffer (Number) or Buffer (Number) is automatically populated by ZEROS.
Upgrade V8 to 5.8:TurboFan & Ingnition
With Node.js 8, the underlying V8 JavaScript engine will also be updated.
For Node.js users, the biggest change is the introduction of TurboFan and Ignition. Ignition is the interpreter of V8 and TurboFan is the optimization compiler.
"the joint use of Ignition and TurboFan has been developed for nearly 3 years, and it represents the final result of the collective understanding of the V8 team, which collected the measured performance of JavaScript and carefully analyzed the shortcomings of Full-codegen and the results of Crankshaft. This is also the basis for continuing to optimize the JavaScript language system in the next few years." -Daniel Clifford and V8 team
The current compilation pipeline for V8 is shown in the following figure.
The biggest problem with this pipeline is that the new language functionality must be implemented in different parts of the pipeline, which adds a lot of additional development work.
Here is a simplified pipeline without FullCode Generator and Crankshaft:
The new pipeline greatly reduces the technical burden on the V8 team and makes a lot of improvements that could not be achieved before.
Learn more about TurboFan and Ignition and TurboFan Inlining Heuristics.
Upgrade npm to 5.0.0
The new Node.js 8 version also comes with npm 5-the latest version of npm CLI.
Highlights of the new npm version:
A new standardized locking file feature for cross-package manager compatibility (package-lock.json), and a new format and semantics for shrinkwrap
-- save is no longer needed because all installations will be saved by default
Node-gyp now supports Windows's node-gyp.cmd
The new release will include sha512 and sha1 checks
Other significant changes in the Node.js 8 release
Buffer
The Buffer method now accepts Uint8Array as input
Child Process
Improved Argument and Kill signal verification
The Child Process method accepts Uint8Array as input
Console
When using the console method, error event sending is now suppressed
Domains
The Native Promise instance is now domain aware
File system
The utility class fs.SyncWriteStream has been deprecated
The deprecated fs.read () string interface has been deleted
HTTP
The overflow Cookie headers will be concatenated into a string
The httpResponse.writeHeader () method has been deprecated
Stream
Stream now supports destroy () and _ destroy () API
TLS
The rejectUnauthorized option now defaults to true
URL
The implementation of WHATWG URL is now fully supported by Node.js API
This is the end of the article on "what are the important functions of Node.js8 and how to fix it?" Thank you for reading! I believe that you all have a certain understanding of the knowledge of "what are the important functions of Node.js8 and what are the ways to repair them?" if you want to learn more, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.