
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
checkpoint-stream
Advanced tools
Queue data from a stream until a checkpoint is hit
$ npm install --save checkpoint-stream
var checkpoint = require('checkpoint-stream')
// getObjectsStream() returns a stream that emits multiple objects
// this will queue up those objects until we reach a checkpoint
// once the `isCheckpointFn` test passes, the queue is flushed
getObjectsStream()
.on('error', function() {...})
.pipe(checkpoint.obj(function(obj) {
return typeof obj.token !== 'undefined'
}))
.on('checkpoint', function(obj) {
// the obj from `getObjectsStream()` that passed the `isCheckpointFn` test
})
.on('data', function(obj) {
// emitted for each object
})
Say you're working with a streaming API that returns many results. Anywhere during transmission, the API call could fail. The API knows this, so it periodically returns a token you can use when you retry the request.
When you get a result that has that token, that's kind of like a "checkpoint". It means, release all the results we've received up until now, because we know we'll be able to pick up from here when we go to retry the request.
TransformStream (via through2)TransformStream (via through2)Object or FunctionA configuration object. If a function is provided, it is treated as config.isCheckpointFn.
FunctionThis function will receive each data event that is emitted from the source stream. Return a boolean to indicate if this is a checkpoint or not. If it is a checkpoint, this event, and any previously queued events before it will be passed through to the next stream in your pipeline. If it is not a checkpoint, this event will be queued until you return true in a future data event.
Number10Configure how many results will be queued before they are released, regardless of if a checkpoint has been reached.
BooleanfalseEnable objectMode when dealing with streams in object mode.
FAQs
Queue data from a stream until a checkpoint is hit
The npm package checkpoint-stream receives a total of 95,658 weekly downloads. As such, checkpoint-stream popularity was classified as popular.
We found that checkpoint-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.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.