diff options
Diffstat (limited to 'std/io/bufio.ts')
-rw-r--r-- | std/io/bufio.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/std/io/bufio.ts b/std/io/bufio.ts index 213870c3c..b287ef3c1 100644 --- a/std/io/bufio.ts +++ b/std/io/bufio.ts @@ -207,15 +207,15 @@ export class BufReader implements Reader { * it returns the data read before the error and the error itself * (often io.EOF). * ReadString returns err != nil if and only if the returned data does not end - * in - * delim. + * in delim. * For simple uses, a Scanner may be more convenient. */ async readString(delim: string): Promise<string | Deno.EOF> { if (delim.length !== 1) throw new Error("Delimiter should be a single character"); const buffer = await this.readSlice(delim.charCodeAt(0)); - return new TextDecoder().decode(buffer || undefined); + if (buffer == Deno.EOF) return Deno.EOF; + return new TextDecoder().decode(buffer); } /** `readLine()` is a low-level line-reading primitive. Most callers should |