feat(xo-cli): @=- can now read from stdin

This commit is contained in:
Julien Fontanet 2023-04-21 16:56:36 +02:00
parent f012d126b9
commit 76a91cc5e9

View File

@ -567,9 +567,9 @@ async function call(args) {
ensurePathParam(method, file)
url = new URL(result[key], baseUrl)
const { size: length } = await stat(file)
const length = file === '-' ? undefined : (await stat(file)).size
const input = pipeline(
createReadStream(file),
file === '-' ? process.stdin : createReadStream(file),
progressStream(
{
length,
@ -583,7 +583,7 @@ async function call(args) {
const response = await hrp(url, {
...httpOptions,
body: input,
headers: {
headers: length && {
'content-length': length,
},
method: 'POST',