Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

delayed-stream

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delayed-stream

Buffers events from a stream until you are ready to handle them.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
51M
increased by14.9%
Maintainers
2
Weekly downloads
 
Created

What is delayed-stream?

The delayed-stream package is a Node.js module that allows you to buffer a stream and release it only when you decide to. This can be useful when you need to collect data from a stream before processing it, or when you want to ensure that a stream's data is only consumed after a certain event or condition is met.

What are delayed-stream's main functionalities?

Create a delayed stream

This feature allows you to create a delayed stream from an existing readable stream. The data from the original stream is buffered until you decide to release it, for example, using a timeout as shown in the code sample.

const DelayedStream = require('delayed-stream');
const fs = require('fs');

const source = fs.createReadStream('source.txt');
const delayed = DelayedStream.create(source);

// You can now wire up event listeners
source.on('data', function(data) {
  console.log('Received data: ' + data);
});

// And later, release the buffered data
setTimeout(function() {
  delayed.pipe(process.stdout);
}, 5000);

Other packages similar to delayed-stream

FAQs

Package last updated on 30 Apr 2015

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