summaryrefslogtreecommitdiff
path: root/io/bufio.ts
diff options
context:
space:
mode:
Diffstat (limited to 'io/bufio.ts')
-rw-r--r--io/bufio.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/io/bufio.ts b/io/bufio.ts
index 9a7bf1dc1..c158e5051 100644
--- a/io/bufio.ts
+++ b/io/bufio.ts
@@ -211,8 +211,11 @@ export class BufReader implements Reader {
* delim.
* For simple uses, a Scanner may be more convenient.
*/
- async readString(_delim: string): Promise<string | Deno.EOF> {
- throw new Error("Not implemented");
+ 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);
}
/** `readLine()` is a low-level line-reading primitive. Most callers should