Skip to content

عند استخدام Bun.spawn()، يمكن استهلاك stdout من العملية الابنة كـ ReadableStream عبر proc.stdout.

ts
const proc = Bun.spawn(["echo", "hello"]);

const output = await proc.stdout.text();
output; // => "hello"

لتحويل stdout من العملية الابنة إلى stdout من العملية الأصلية، اضبط على "inherit".

ts
const proc = Bun.spawn(["echo", "hello"], {
  stdout: "inherit",
});

راجع الوثائق > API > عمليات الابنة للحصول على الوثائق الكاملة.

Bun بواسطة www.bunjs.com.cn تحرير