stream/iter 模块


🌐 The stream/iter module

所有函数既可以作为命名导出使用,也可以作为 Stream 命名空间对象的属性使用:

🌐 All functions are available both as named exports and as properties of the Stream namespace object:

// Named exports
import { from, pull, bytes, Stream } from 'node:stream/iter';

// Namespace access
Stream.from('hello');// Named exports
const { from, pull, bytes, Stream } = require('node:stream/iter');

// Namespace access
Stream.from('hello');

在模块说明符中包含 node: 前缀是可选的。

🌐 Including the node: prefix on the module specifier is optional.