Through stream for Node to slow incoming data to specific intervals.
For example, the following script will pipe itself to
to one chunk per second.
var es =trickle =fs =var stream =fs
Of course, this stream buffers data. If you want to discard input to avoid
the stream filling up, use the
limit option: this limits the total amount of
chunks that the stream will buffer.
By default, the stream will ignore any new data if the buffer is full. Using the
mru flag, the stream will instead remove the oldest chunk and add the new one
to the end of the queue.
// Emits the most recent recieved chunk// every second.// Stores up to 50 chunks, discarding any// after that. Flushes one chunk every// five seconds.
interval: The interval period, in milliseconds. Defaults to 50.
limit: Maximum amount of chunks to buffer at once. Omit this field to buffer content endlessly.
mru: Remove old chunks to make space for new ones. Disabled by default.
flush: Amount of chunks to flush each interval. Defaults to 1.