
Security News
Socket Integrates With Bun 1.3’s Security Scanner API
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
@nitedani/rxjs-stream
Advanced tools
Currently this package has one function: `fromReadStream<T>(readStream:stream.Readable): Observable<T>` `fromReadStream` creates an rxjs observable from a node readstream with backpressure support. How it works: the underlying read
Currently this package has one function:
fromReadStream<T>(readStream:stream.Readable): Observable<T>
fromReadStream
creates an rxjs observable from a node readstream with backpressure support.
How it works: the underlying readstream is paused whenever a new chunk is read, and resumed after the value is emitted and processed by the observer.
Example:
import { createReadStream } from "fs";
import { fromReadStream } from "@nitedani/rxjs-stream";
import { delay, tap, map } from "rxjs/operators";
const rs = createReadStream("huge_file.txt",{
encoding: "utf-8",
});
fromReadStream<string>(rs)
.pipe(
tap(() => {
console.log("Processing chunk...");
}),
map((chunk) => chunk.toLowerCase()),
delay(1000)
)
.subscribe((chunk) => console.log(chunk));
Processing large json array with stream-json:
import { createReadStream } from "fs";
import { fromReadStream } from "@nitedani/rxjs-stream";
import { delay, tap } from "rxjs/operators";
import { withParser } from "stream-json/streamers/StreamArray";
const rs = createReadStream("huge_array.json", {
encoding: "utf-8",
});
const jsonStream = rs.pipe(withParser());
fromReadStream(jsonStream)
.pipe(
tap(() => {
console.log("Processing chunk...");
}),
delay(1000)
)
.subscribe({
next: (chunk) => console.log(chunk),
complete: () => {
console.log("complete");
},
});
Processing large csv file with fast-csv:
import { createReadStream } from "fs";
import { fromReadStream } from "@nitedani/rxjs-stream";
import { delay, tap } from "rxjs/operators";
import { parse } from "fast-csv";
const rs = createReadStream("huge_csv.csv");
const csvStream = rs.pipe(parse({ headers: true }));
fromReadStream(csvStream)
.pipe(
tap(() => {
console.log("Processing chunk...");
}),
delay(1000)
)
.subscribe({
next: (chunk) => console.log(chunk),
complete: () => {
console.log("complete");
},
});
FAQs
Currently this package has one function: `fromReadStream<T>(readStream:stream.Readable): Observable<T>` `fromReadStream` creates an rxjs observable from a node readstream with backpressure support. How it works: the underlying read
We found that @nitedani/rxjs-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.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Security News
Python 3.14 adds template strings, deferred annotations, and subinterpreters, plus free-threaded mode, an experimental JIT, and Sigstore verification.
Security News
Former RubyGems maintainers have launched The Gem Cooperative, a new community-run project aimed at rebuilding open governance in the Ruby ecosystem.