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

x/deno/std/textproto/mod.ts>TextProtoReader

A modern runtime for JavaScript and TypeScript.
Go to Latest
class TextProtoReader
import { TextProtoReader } from "https://deno.land/x/deno@v0.28.0/std/textproto/mod.ts";

Constructors

new
TextProtoReader(r: BufReader)

Methods

readLine(): Promise<string | Deno.EOF>

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

readLineSlice(): Promise<Uint8Array | Deno.EOF>
readMIMEHeader(): Promise<Headers | Deno.EOF>

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