Skip to main content
Module

x/proc/deps.ts>TextProtoReader

A high-level way to run child processes that is easy, flexible, powerful, and prevents resource leaks.
Go to Latest
class TextProtoReader
Deprecated
Deprecated

(will be removed after 0.159.0) Use TextLineStream from std/steams for line-by-line text reading instead.

import { TextProtoReader } from "https://deno.land/x/proc@0.19.8/deps.ts";

Constructors

new
TextProtoReader(r: BufReader)

Methods

readLine(): Promise<string | null>

readLine() reads a single line from the TextProtoReader, eliding the final \n or \r\n from the returned string.

readLineSlice(): Promise<Uint8Array | null>
readMimeHeader(): Promise<Headers | null>

ReadMimeHeader reads a MIME-style header from r. The header is a sequence of possibly continued Key: Value lines ending in a blank line. The returned map m maps CanonicalMIMEHeaderKey(key) to a sequence of values in the same order encountered in the input.

For example, consider this input:

My-Key: Value 1
Long-Key: Even
       Longer Value
My-Key: Value 2

Given that input, ReadMIMEHeader returns the map:

map[string][]string{
	"My-Key": {"Value 1", "Value 2"},
	"Long-Key": {"Even Longer Value"},
}
skipSpace(l: Uint8Array): number