Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
toflush
Advanced tools
Readme
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.
The npm package toflush receives a total of 1 weekly downloads. As such, toflush popularity was classified as not popular.
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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.