Module

std/io/buffer.ts>BufReader#readLine

Deno standard library
Go to Latest
method BufReader.prototype.readLine
import { BufReader } from "https://dotland.deno.dev/std@0.119.0/io/buffer.ts";

readLine() is a low-level line-reading primitive. Most callers should use readString('\n') instead or use a Scanner.

readLine() tries to return a single line, not including the end-of-line bytes. If the line was too long for the buffer then more is set and the beginning of the line is returned. The rest of the line will be returned from future calls. more will be false when returning the last fragment of the line. The returned buffer is only valid until the next call to readLine().

The text returned from ReadLine does not include the line end ("\r\n" or "\n").

When the end of the underlying stream is reached, the final bytes in the stream are returned. No indication or error is given if the input ends without a final line end. When there are no more trailing bytes to read, readLine() returns null.

Calling unreadByte() after readLine() will always unread the last byte read (possibly a character belonging to the line end) even if that byte is not part of the line returned by readLine().

Returns

Promise<ReadLineResult | null>