In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "what are the new features of Node18". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Native support for fetchconst res = await fetch ('https://nodejs.org/api/documentation.json');if (res.ok) {const data = await res.json (); console.log (data);}
Experimental fetch API is supported in the global environment of Node. The implementation is based on undici, a HTTP/1.1 client written for Node.
Meanwhile, Node can now use the following global variables: fetch, FormData, Headers, Request, and Response.
two。 Built-in test runnerimport test from 'node:test'; import * as assert from' assert/strict'; test ('sync test', (t) = > {assert.equal (1,1);}); test (' async test', async (t) = > {assert.equal (1,1);}); 3. Web Streams
Node downloads support Web Streams API (MDN), which means that Node allows JavaScript to programmatically access data streams received over the network through Streams API.
4. Blob
Buffer's new Blob API,Blob encapsulates immutable raw data, which can be safely shared among multiple worker threads.
In addition, the new BroadcastChannel instance allows asynchronous one-to-many communication with all other BroadcastChannel instances bound to the same channel name.
5. Use the new version of V8
V8 will be updated to version 10.1, which is part of Chromium 101s. Compared to Node.JS 17.9.0, it includes the following new features:
FindLast () and findlastedex () array methods.
Improvements to Intl.Locale API.
Intl.SupportedValues of the function.
Improved performance of class fields and private class methods (they are now initialized as fast as normal property stores).
6. Support for import JSON
The Import Assertions proposal adds inline syntax to the module import statement. The purpose of such assertions is to support other types of modules in a common way across JavaScript environments, starting with JSON modules.
The syntax is as follows (recommended methods for importing JSON modules):
Import json from ". / foo.json" assert {type: "json"}; import ("foo.json", {assert: {type: "json"}); and that's all for "what are the new features of Node18". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.