
Research
/Security News
Mini Shai-Hulud Campaign Hits Red Hat Cloud Services npm Packages
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.
from-node-stream
Advanced tools
Create a script that pipes process stdin through a bash process and then to stdout:
import { exec } from "child_process";
import { fromStdio } from "from-node-stream";
import { fromReadable } from "from-node-stream/fromReadable";
import { fromWritable } from "from-node-stream/fromWritable";
// Execute everything from stdin in bash and then output to stdout
await fromReadable(process.stdin)
.pipeThrough(fromStdio(exec("bash")))
.pipeTo(fromWritable(process.stdout));
import { exec } from "child_process";
import { fromWritable, fromReadable } from "from-node-stream";
const p = exec("sh");
// Write to stdin
const writer = fromWritable(p.stdin!).getWriter();
await writer.write("echo hello, world\n");
await writer.close();
// Read from stdout
const reader = fromReadable(p.stdout!).getReader();
let output = "";
while (true) {
const { value, done } = await reader.read();
if (done) break;
output += typeof value === "string" ? value : new TextDecoder().decode(value);
}
console.log(output); // "hello, world\n"
fromStdioDropErrimport { exec } from "child_process";
import { fromStdioDropErr } from "from-node-stream";
const p = exec("sh");
// Write to stdin
const writer = fromStdioDropErr(p).writable.getWriter();
await writer.write("echo hello, world\n");
await writer.close();
// Read from stdout
const reader = fromStdioDropErr(p).readable.getReader();
let output = "";
while (true) {
const { value, done } = await reader.read();
if (done) break;
output += typeof value === "string" ? value : new TextDecoder().decode(value);
}
console.log(output); // "hello, world\n"
fromStdioMergeErrorimport { exec } from "child_process";
import { fromStdioMergeError } from "from-node-stream";
const p = exec("sh");
// Write to stdin
const writer = fromStdioMergeError(p).writable.getWriter();
await writer.write("echo oops, error>&2 && echo hell, word\n");
await writer.close();
// Read merged stdout and stderr
const reader = fromStdioMergeError(p).readable.getReader();
let output = "";
while (true) {
const { value, done } = await reader.read();
if (done) break;
output += typeof value === "string" ? value : new TextDecoder().decode(value);
}
console.log(output); // "oops, error\nhell, word\n"
fromStdioDropErrimport { exec } from "child_process";
import { fromStdioDropErr } from "from-node-stream";
const p = exec("sh");
// Write to stdin
const writer = fromStdioDropErr(p).writable.getWriter();
await writer.write("echo oops, error>&2 && echo hell, word\n");
await writer.close();
// Read from stdout only (stderr dropped)
const reader = fromStdioDropErr(p).readable.getReader();
let output = "";
while (true) {
const { value, done } = await reader.read();
if (done) break;
output += typeof value === "string" ? value : new TextDecoder().decode(value);
}
To install dependencies:
bun install
To run:
bun run index.ts
This project was created using bun init in bun v1.1.21. Bun is a fast all-in-one JavaScript runtime.
FAQs
convert nodejs-stream into webstream
The npm package from-node-stream receives a total of 1,692 weekly downloads. As such, from-node-stream popularity was classified as popular.
We found that from-node-stream 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.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.

Research
/Security News
The North Korean malware loader hides in a Packagist-listed package and its GitHub branch to fetch and execute remote code in a likely Contagious Interview-style lure.

Security News
The Rust project is moving toward formal rules on LLM use in contributions after months of internal debate over maintainer burden, code quality, and contributor experience.