Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/proc/legacy/deps.ts>BufReader#readLine

A high-level way to run child processes that is easy, flexible, powerful, and prevents resource leaks.
Go to Latest
method BufReader.prototype.readLine
Re-export
import { BufReader } from "https://deno.land/x/proc@0.20.26/legacy/deps.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>