INNER CODE UNIT · TypeScript
read
cloudflare/serverless-registry · push/index.ts:8
async function read(stream: stream.Readable): Promise<string> {
const chunks = [];
for await (const chunk of stream.iterator()) {
chunks.push(chunk);
}
return Buffer.concat(chunks).toString("utf8");
}
let password;
if (process.stdin.isTTY) {
console.error(
"You need to pass the password with a pipe operator \n\n\t'echo <YOURPASSWORD> | USERNAME_REGISTRY=... bun run index.ts'\n",
);
} else {
password = (await read(process.stdin)).trim();
}