readable.drop(limit[, options])
稳定性: 1 - 实验性的
¥Stability: 1 - Experimental
-
limit
<number> 从可读中删除的块数。¥
limit
<number> the number of chunks to drop from the readable. -
options
<Object>-
signal
<AbortSignal> 如果信号中止,允许销毁流。¥
signal
<AbortSignal> allows destroying the stream if the signal is aborted.
-
-
返回:<Readable> 是一个流,其中有
limit
个块被丢弃。¥Returns: <Readable> a stream with
limit
chunks dropped.
此方法返回一个新流,其中删除了前 limit
个块。
¥This method returns a new stream with the first limit
chunks dropped.
import { Readable } from 'node:stream';
await Readable.from([1, 2, 3, 4]).drop(2).toArray(); // [3, 4]