New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

debounce-stream

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debounce-stream

A stream that only forwards input once in a given interval

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
491
decreased by-4.66%
Maintainers
1
Weekly downloads
 
Created
Source

debounce-stream

This stream takes in events of data and only passes the event on once in a given interval. Once the interval is over, it outputs the last value that was passed in

Installing

npm install --save debounce-stream

API

DebounceStream(interval,[options])

Arguments
  • interval (Number): Interval for how frequently to output data
  • [options] (Object): Options that get passed to a stream constructor (In case you want objectMode)
Returns

(DuplexStream): Pipe stuff into it, and it'll come out debounced

Example

var DebounceStream = require("../");
var IntervalStream = require("interval-stream");
var StreamArray = require("stream-array");
var stdout = require("stdout")();

// Data to output
var data = ["foo\n", "bar\n", "bazz\n", "fizz\n"];

// Duplicate it twice so we have more data to send
data = data.concat(data).concat(data);

StreamArray(data) // Should take all the data in the array,
  .pipe(IntervalStream(1000)) // Send out one item every second,
  .pipe(DebounceStream(2000)) // Ignore about every other chunk
  .pipe(stdout); // Output to the console

Keywords

FAQs

Package last updated on 12 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc