Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
pause-stream
Advanced tools
a ThroughStream that strictly buffers all readable events when paused.
Weekly downloads
Package description
The pause-stream package is a Node.js module that allows you to pause and resume streaming data. It is particularly useful in scenarios where you need to control the flow of data, for example, when processing or transforming data in chunks. It provides a simple API to pause the data stream, process the current chunk of data, and then resume the stream when ready.
Pausing and resuming a stream
This feature allows you to pause the flow of data in a stream and then resume it. The code sample demonstrates how to create a readable stream from a file, pipe it through a pause-stream, pause the stream to process data, and then resume the stream.
"use strict";
const pause = require('pause-stream')();
const fs = require('fs');
let dataStream = fs.createReadStream('data.txt');
dataStream.pipe(pause);
pause.pause();
// Process data here
pause.resume();
Through2 is a tiny wrapper around Node streams.Transform (Streams2/3) to avoid explicit subclassing noise. It's similar to pause-stream in that it helps with stream manipulation, but it focuses more on transforming stream data rather than pausing and resuming.
Stream-pause provides functionality similar to pause-stream, offering a way to pause and resume streams. However, it might have a different API or implementation details, catering to slightly different use cases or preferences.
Highland.js manages synchronous and asynchronous code easily, using nothing more than standard JavaScript and Node-like Streams. While it offers much more than pausing and resuming streams, including a wide range of operations like map, filter, and reduce, it can be used for similar purposes but is more comprehensive.
Readme
This is a Stream
that will strictly buffer when paused.
Connect it to anything you need buffered.
var ps = require('pause-stream')();
badlyBehavedStream.pipe(ps.pause())
aLittleLater(function (err, data) {
ps.pipe(createAnotherStream(data))
ps.resume()
})
PauseStream
will buffer whenever paused.
it will buffer when yau have called pause
manually.
but also when it's downstream dest.write()===false
.
it will attempt to drain the buffer when you call resume
or the downstream emits 'drain'
PauseStream
is tested using stream-spec
and stream-tester
This is now the default case of through
https://github.com/dominictarr/pause-stream/commit/4a6fe3dc2c11091b1efbfde912e0473719ed9cc0
FAQs
a ThroughStream that strictly buffers all readable events when paused.
The npm package pause-stream receives a total of 2,950,366 weekly downloads. As such, pause-stream popularity was classified as popular.
We found that pause-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.