Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Transform on Flush. Process an entire object mode stream in a single function call.
npm install --save toflush
May have a synchronous callback.
fs.createReadStream('./rows.db') // newline delimited json
.pipe(split(JSON.parse))
.pipe(toflush(JSON.stringify))
.pipe(fs.createWriteStream('./database.json')) // write out as a JSON array
May have a asynchronous, Promise returning, callback.
fs.createReadStream('./images.db')
.pipe(split(JSON.parse))
.pipe(toflush(items => {
return fetch(items[0].url).then(response => {
if (response.ok) {
return response.buffer();
}
throw new Error(`${response.status} ${response.statusText}`);
});
})
.on('error', error => /* handle fetch or response error */)
.pipe(fs.createWriteStream('./first.png'));
There are more examples available in the documentation and in the test cases.
A single function that receives either an options object or a callback.
options.callback
- function that receives all objects from the stream
as the first argument. Should return an object, array, or a promise. More
detail below.options.name
- String name to use in error message. Default toflush
. May
also be provide by the callback name.options.stream
- Boolean sanity flag that makes vinyl content streams
opt-in.Same as the callback in the options above. Any thrown error or rejection is emitted by the stream.
callback(items) -> Object
- take all objects, and return a single object.callback(items) -> Object[]
- take all objects, and return any number of
objects. May be the same, more, or less than the input. Each item is pushed
into the stream, not the array.callback(items) -> Promise<Object>
- take all objects, and then promise
a single object.callback(items) -> Promise<Object[]>
- take all objects, and then
promise any number of objects. May be the same, more, or less than the
input. Each item is pushed into the stream, not the array.You must be using node.js v4.x or later. This module has no dependencies,
taking advantage of the improved stream.Transform
implementation.
gulp
.MIT © Cody A. Taylor 2018
FAQs
Process an entire object mode stream in a single function call.
We found that toflush 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
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.