Files
NapCatQQ/.pnpm-store/v3/files/93/3c2fae4666168e0894e2fb30917d3e8a69df9ca1ac523cf446063b2663bee39f2f8c515f2f3de4d593d292d415d00cc6c25ebc7c08c749b21a298e82f1eb30
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

34 lines
488 B
Plaintext

const {stdin} = process;
export default async function getStdin() {
let result = '';
if (stdin.isTTY) {
return result;
}
stdin.setEncoding('utf8');
for await (const chunk of stdin) {
result += chunk;
}
return result;
}
getStdin.buffer = async () => {
const result = [];
let length = 0;
if (stdin.isTTY) {
return Buffer.concat([]);
}
for await (const chunk of stdin) {
result.push(chunk);
length += chunk.length;
}
return Buffer.concat(result, length);
};