
Security News
RubyGems Adds Cooldown Feature to Bundler for Newly Published Gems
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.
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,839 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.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.

Security News
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.