diff --git a/cmd/rcat/main.js b/cmd/rcat/main.js index 6136c52..bbeef0e 100644 --- a/cmd/rcat/main.js +++ b/cmd/rcat/main.js @@ -1,3 +1,4 @@ +import process from "node:process"; import { fetch } from "../../mod.js"; /** @@ -7,9 +8,19 @@ import { fetch } from "../../mod.js"; * @returns {Promise} */ export function rcat(destination, flags) { + const body = new ReadableStream({ + start(controller) { + process.stdin.on("data", (chunk) => { + controller.enqueue(chunk); + }); + process.stdin.on("end", () => { + controller.close(); + }); + }, + }); + return fetch(`${destination}?${new URLSearchParams(flags)}`, { method: "PUT", - // TODO: Switch to `node:process.stdin`. - body: Deno.stdin.readable, + body, }); }