Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
utilitystreams
Advanced tools
Convenient Streams, simple and easy to use.
$ npm install utilitystreams
// ...
import { DebounceStream } from "utilitystreams";
// ...
app.use("/stream-req", async (req, res) => {
await pipeline(
req,
new DebounceStream({ waitMs: 300 }),
createWriteStream("/file/path/to/save"),
);
});
All stream have test files. Detailed usage can be found in the test file.
Collect the input data into an array.
Outputs the array of collected data if
import { BufferStream } from "utilitystreams";
await pipeline(
process.stdout,
new BufferStream({ size: 100, waitMs: 1000 }, { objectMode: true }),
saveToDbStream,
);
Accumulate the input data into the acc object.
import { ReduceStream } from "utilitystreams";
await pipeline(
arguments,
new ReduceStream(
{ acc: "", f: (acc, cur) => `${acc} ${cur}` },
{ objectMode: true },
),
process.stdout,
);
Collects the input data into an array.
import { ToArrayStream } from "utilitystreams";
const csvLines = [];
await pipeline(
createReadStream("data.csv"),
csvParser,
new ToArrayStream({ target: csvLines }),
);
Delays the input data by the set time.
import { DelayStream } from "utilitystreams";
await pipeline(
process.stdin,
new DelayStream({ waitMs: 3000 }),
process.stdout,
);
Outputs only the last of the input data for the set time period.
import { DebounceStream } from "utilitystreams";
await pipeline(
process.stdin,
new DebounceStream({ waitMs: 100 }),
process.stdout,
);
Ignore other input data for the time you set after the data output.
import { ThrottleStream } from "utilitystreams";
await pipeline(
process.stdin,
new ThrottleStream({ waitMs: 100 }),
process.stdout,
);
Make output data from input data using the mapper function.
import { MapStream } from "utilitystreams";
await pipeline(
process.stdout,
new MapStream(
{
f: (message: string) => {
const logObj = {
timestamp: new Date().toISOString(),
message: message,
};
return JSON.stringify(logObj);
},
},
{ objectMode: true },
),
createWriteStream("/path/to/file.log"),
);
Filter input data only passed by the predicate function.
import { FilterStream } from "utilitystreams";
await pipeline(
naturalNumbers,
new FilterStream(
{
f: (num: number): boolean => {
return num % 2 === 0;
},
},
{ objectMode: true },
),
createWriteStream("/even-nums"),
);
Create a wrapped stream that yields at most n data from the source stream.
takeStreamFactory({ n: 10 }, sourceStream)
-> takeStreamFactory({ n: 10 })(sourceStream)
Readable.from
.import { takeStreamFactory } from "utilitystreams";
await pipeline(
takeStreamFactory({ n: 10 }, readableStream),
// ... other streams
process.stdout,
);
Yield at most n data from the input data.
takeStreamFactory
.
import { TakeStream } from "utilitystreams";
await pipeline(
readableStream,
// ... other streams
new TakeStream({ n: 10 }),
process.stdout,
);
Create a wrapped stream that yields data from the source stream while the predicate function returns true.
takeWhileStreamFactory({ f: predicate }, sourceStream)
-> takeWhileStreamFactory({ f: predicate })(sourceStream)
Readable.from
.import { takeWhileStreamFactory } from "utilitystreams";
await pipeline(
takeWhileStreamFactory({ f: predicate }, readableStream),
// ... other streams
process.stdout,
);
Yield data while the predicate function returns true.
takeWhileStreamFactory
. **
import { TakeWhileStream } from "utilitystreams";
await pipeline(
readableStream,
// ... other streams
new TakeWhileStream({ f: predicate }),
process.stdout,
);
Create a wrapped stream that yields data from the source stream until the predicate function returns true.
takeUntilStreamFactory({ f: predicate }, sourceStream)
-> takeUntilStreamFactory({ f: predicate })(sourceStream)
Readable.from
.import { takeUntilStreamFactory } from "utilitystreams";
await pipeline(
takeUntilStreamFactory({ f: predicate }, readableStream),
// ... other streams
process.stdout,
);
Yield data until the predicate function returns true.
takeUntilStreamFactory
. **
import { TakeUntilStream } from "utilitystreams";
await pipeline(
readableStream,
// ... other streams
new TakeUntilStream({ f: predicate }),
process.stdout,
);
Execute the consumer function with input data.
import { TapStream } from "utilitystreams";
await pipeline(
messages,
new TapStream(
{
f: (message: string) => {
log.info(message);
},
},
{ objectMode: true },
),
);
FAQs
Convenient Streams
The npm package utilitystreams receives a total of 1 weekly downloads. As such, utilitystreams popularity was classified as not popular.
We found that utilitystreams demonstrated a healthy version release cadence and project activity because the last version was released less than 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.