Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
rxjs-stream
Advanced tools
This is a simple library for converting to and from NodeJS stream and RxJS 7.
This was created to fill the gap left by rx-node, which only works with rxjs 4.
npm install --save rxjs rxjs-stream
import { rxToStream } from 'rxjs-stream';
let data = 'This is a bit of text to have some fun with';
let src = Rx.Observable.from(data.split(' '));
rxToStream(src).pipe(process.stdout);
To write objects, you must pass in the ReadableOptions
with objectMode
to be true: { objectMode: true }
import { rxToStream } from 'rxjs-stream';
let data = 'This is a bit of text to have some fun with';
let wordObj = data.split(' ').map((text) => ({ text }));
let src = Rx.Observable.from(wordObj);
let stream = rxToStream(src, { objectMode: true });
import { rxToStream, streamToStringRx } from 'rxjs-stream';
// Read stdin and make it upper case then send it to stdout
let ob = streamToStringRx(process.stdin).map((text) => text.toUpperCase());
rxToStream(ob).pipe(process.stdout);
It is recommended to buffer observable values before sending them to the stream. Node streams work better with fewer calls of a large amount of data than with many calls with a small amount of data.
Example:
import * as loremIpsum from 'lorem-ipsum';
import { rxToStream } from 'rxjs-stream';
let book = loremIpsum({ count: 1000, format: 'plain', units: 'paragraphs' });
let words = Rx.Observable.from(book.split(/\b/));
let wordsBuffered = words.bufferCount(1000).map((words) => words.join(''));
let stream = rxToStream(wordsBuffered);
stream.pipe(process.stdout);
This library is tested with Node 12 and above.
rx-stream | RxJS | Node |
---|---|---|
4.x | 7.x | >=12 |
3.x | 6.x | >=10 |
5.0.0 (2022-06-07)
Note: The code has not changed, but the cost of maintaining the tools is too high.
FAQs
nodejs streams for rxjs 7
The npm package rxjs-stream receives a total of 4,821 weekly downloads. As such, rxjs-stream popularity was classified as popular.
We found that 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.