readable.take(limit[, options])


稳定性: 1 - 实验性

该方法返回一个包含前 limit 个数据块的新流。

【This method returns a new stream with the first limit chunks.】

import { Readable } from 'node:stream';

await Readable.from([1, 2, 3, 4]).take(2).toArray(); // [1, 2]