流的 Promise API


stream/promises API 为返回 Promise 对象(而不是使用回调)的流提供了一组替代的异步实用函数。 API 可通过 require('node:stream/promises')require('node:stream').promises 访问。

The stream/promises API provides an alternative set of asynchronous utility functions for streams that return Promise objects rather than using callbacks. The API is accessible via require('node:stream/promises') or require('node:stream').promises.