diff options
Diffstat (limited to 'js/xeval.ts')
-rw-r--r-- | js/xeval.ts | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/js/xeval.ts b/js/xeval.ts index 81e79f590..fa706ae20 100644 --- a/js/xeval.ts +++ b/js/xeval.ts @@ -1,22 +1,10 @@ -import { Buffer } from "./buffer"; +import { Buffer, writeAll } from "./buffer"; import { stdin } from "./files"; import { TextEncoder, TextDecoder } from "./text_encoding"; import { Reader, EOF } from "./io"; export type XevalFunc = (v: string) => void; -async function writeAll(buffer: Buffer, arr: Uint8Array): Promise<void> { - let bytesWritten = 0; - while (bytesWritten < arr.length) { - try { - const nwritten = await buffer.write(arr.subarray(bytesWritten)); - bytesWritten += nwritten; - } catch { - return; - } - } -} - // TODO(kevinkassimo): Move this utility to deno_std. // Import from there once doable. // Read from reader until EOF and emit string chunks separated |