In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Node.js 8 has what important features and fixes, I believe that many inexperienced people are helpless about this, for this reason this article summarizes the causes and solutions of the problem, through this article I hope you can solve this problem.
Async Hooks API Introduction
The Async Hooks (formerly known as AsyncWrap) API allows you to get structural trace information about the lifecycle of a handle object.
The message sent by the API informs the consumer of the lifecycles of all handle objects in Node.js. It tries to solve problems like continuation-local-storage npm package.
If you're using continuation-local-storage, you can already use async hooks called cls-hooks instead-it's just not the best time to use async hooks right now, so use them carefully!
How the Async Hooks API works in Node.js 8
The registration function of the createHooks function is invoked 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 of work in progress. These functions are selectively triggered based on lifecycle events of the handler object.
N-API Introduction
N-API is the API used to build native plugins. It is independent of the underlying JavaScript runtime and maintained as part of Node.js itself. The goal is to ensure that the application binary interface (ABI) remains stable across different versions of Node.js.
The purpose of the N-API is to separate add-ons from changes in the base JavaScript engine so that native plugins can run different versions of Node.js without having to recompile.
Learn more about N-API.
Buffer security improvements in Node.js 8
Prior to Node.js version 8, buffers allocated using the new Buffer(Number) constructor did not use ZEROS to initialize memory space. As a result, new Buffer instances may contain sensitive information, which can easily lead to security issues.
Although this is a decision to improve the performance of creating new buffers, it is not intended for most people. So starting with Node.js 8, Buffers assigned with new Buffer(Number) or Buffer(Number) are automatically populated by ZEROS.
Upgrade V8 to 5.8: TurboFan& Intention
With Node.js version 8, the underlying V8 JavaScript engine is updated as well.
For Node.js users, the biggest change is the introduction of TurboFan and Ignition. Ignition is the interpreter for V8 and TurboFan is the optimizing compiler.
"The combined use of Ignition and TurboFan has been developed for nearly three years. In 2010, it represented the end result of the V8 team's collective understanding of JavaScript's measured performance and careful analysis of Full-codegen's shortcomings and Crankshaft. This is also the basis for continuing to optimize the JavaScript language architecture in the years ahead. " - Daniel Clifford and the V8 team
The current V8 compilation pipeline is shown below.
The biggest problem with this pipeline is that new language features have to be implemented in different parts of the pipeline, which adds a lot of extra development effort.
Below is a simplified pipeline without the FullCode Generator and Crankshaft:
The new pipeline significantly reduces the technical burden on the V8 team and enables many improvements that were previously impossible to achieve.
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 lock 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 node-gyp.cmd for Windows
The new release will include sha512 and sha1 checksums
Other notable changes in Node.js 8 Buffer
Buffer method now accepts Uint8Array as input
Child Process
Improved Argument and Kill signal validation
The Child Process method accepts Uint8Array as input
Console
Error event sending is now suppressed when using console methods
Domains
Native Promise instances are now domain aware
file system
Utility class fs.SyncWriteStream deprecated
The deprecated fs.read( ) string interface has been removed
HTTP
Overflow Cookie headers are concatenated into a string
The httpResponse.writeHeader( ) method has been deprecated
Stream
Stream now supports destroy( ) and_destroy( ) APIs
TLS
The reject Unauthorized option now defaults to true
URL
WHATWG URL implementation, now fully supported by Node.js API
After reading the above content, do you know what important functions and repair methods Node.js8 has? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!
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.