Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
collect-all
Advanced tools
DEPRECATED. This package has been replaced by stream-read-all which does the same job but with a Promises interface.
Returns a stream which fires a callback and becomes readable once all input is received.
By default the callback is invoked with a Buffer instance containing all concatenated input. If you set the option { objectMode: true }
the callback is invoked with an array containing all objects received.
Duplex
⏏Kind: Exported function
Param | Type | Description |
---|---|---|
[callback] | function | Called once with the collected input data (by default a Buffer instance, or array in objectMode .). The value returned by this callback function will be passed downstream. |
[options] | object | Stream options object, passed to the constructor for the stream returned by collect-all . If the callback function supplied returns a non-string/buffer value, set options.objectMode to true . |
Example
An example command-line client script - string input received at stdin is stamped with received
then written to stdout.
var collectAll = require('collect-all')
process.stdin
.pipe(collectAll(function (input) {
input = 'received: ' + input
return input
}))
.pipe(process.stdout)
An object-mode example:
var collectAll = require('collect-all')
function onAllCollected (collected) {
console.log('Objects collected: ' + collected.length)
}
var stream = collectAll(onAllCollected, { objectMode: true })
stream.write({})
stream.write({})
stream.end({}) // outputs 'Objects collected: 3'
© 2015-17 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.
FAQs
Returns a stream which becomes readable once all input is received
We found that collect-all 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.