2023-11-06 15:36:41 -05:00
|
|
|
/**
|
|
|
|
* Wrap the runtime-specific hook into stdin
|
|
|
|
*/
|
|
|
|
export async function* inputLoop() {
|
|
|
|
for await (const chunk of Bun.stdin.stream()) {
|
|
|
|
yield chunk;
|
|
|
|
}
|
2023-11-08 12:45:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export async function write(s: string): Promise<void> {
|
|
|
|
const buffer = new TextEncoder().encode(s);
|
|
|
|
|
|
|
|
await Bun.write(Bun.stdout, buffer);
|
|
|
|
}
|