本文发布于山月的博客原地址: weekly.shanyue.tech
Node v16.1.0 发布,值得注意的一个更新是 fileHanle.read() 可以不带参数
async function validateReadNoParams() {
const filePath = fixtures.path('x.txt');
const fileHandle = await open(filePath, 'r');
// Should not throw
await fileHandle.read();
}
还有一个值得注意的点是 Node 10 被标记为 End of life,2021-04-30 是 Node 10 作为 Maintenance Start 的最后一天,今后将不再维护。
querystring API 考虑将被遗弃,使用 URLSearchParams API 代替,而该 API 已经可以在浏览器中使用。
const q = new URLSearchParams('?a=3')
q.get('a')
//=> 3
更多修改可查看 Node v16.1.0 发布文档