readable.drop(limit[, options])


稳定性: 1 - 实验

此方法返回新的流,其前 limit 个块被丢弃。

import { Readable } from 'node:stream';

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

Stability: 1 - Experimental

  • limit <number> the number of chunks to drop from the readable.
  • options <Object>
    • signal <AbortSignal> allows destroying the stream if the signal is aborted.
  • Returns: <Readable> a stream with limit chunks dropped.

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]