mimekit-ts - v1.0.0
    Preparing search index...

    Class Header

    Represents a message header field and value.

    Index
    • Creates a new header.

      Parameters

      • ...args: HeaderCtor

        A field/id with value, optionally prefixed by a charset.

      Returns Header

      The field, charset, or value is null, undefined, or invalid.

      The header id is not valid.

    options: ParserOptions

    The parser options associated with this header.

    rawField: Uint8Array

    The raw header field bytes.

    offset: number | null = null

    The byte offset of this header, if known.

    field: string

    The header field name.

    The well-known header identifier.

    isInvalid: boolean

    Whether this header is invalid.

    onChanged: (() => void) | null = null

    Invoked when the header changes.

    • get rawValue(): Uint8Array

      The raw header value bytes.

      Returns Uint8Array

    • get value(): string

      The decoded and unfolded header value.

      Returns string

    • set value(value: string): void

      Parameters

      • value: string

      Returns void

    • Creates a header from raw field and value bytes.

      Parameters

      • options: ParserOptions

        The parser options.

      • id: string

        The header identifier.

      • field: string

        The header field name.

      • rawValue: Uint8Array

        The raw header value bytes.

      • invalid: boolean = false

        Whether the header is syntactically invalid.

      • OptionalrawField: Uint8Array<ArrayBufferLike>

        The raw field bytes.

      Returns Header

      The created header.

    • Gets the decoded header value using the specified charset.

      Parameters

      Returns string

      The decoded and unfolded header value.

      charset is null or undefined.

    • Sets the header value using the specified formatting options and charset.

      Parameters

      • format: FormatOptions

        The formatting options.

      • charset: string | CharsetEncoding

        The charset to use for encoding.

      • value: string

        The header value.

      Returns void

      format, charset, or value is null or undefined.

    • Sets the header value using the specified charset.

      Parameters

      • charset: string | CharsetEncoding

        The charset to use for encoding.

      • value: string

        The header value.

      Returns void

      charset or value is null or undefined.

    • Sets the raw header value bytes.

      Parameters

      • value: Uint8Array

        The raw value bytes, including a trailing newline.

      Returns void

      value is null, undefined, or does not end with a newline.

    • Gets the raw header value bytes for the specified formatting options.

      Parameters

      Returns Uint8Array

      The raw header value bytes.

    • Serializes this header.

      Returns string

      A string representing this header.

    • Unfolds a header value by removing line breaks.

      Parameters

      • text: string | null | undefined

        The header value text.

      Returns string

      The unfolded header value.

    • Folds a header value according to the specified formatting options.

      Parameters

      • format: FormatOptions

        The formatting options.

      • field: string

        The header field name.

      • value: string

        The header value.

      Returns string

      The folded header value.

    • Reformats an address header value for the specified formatting options.

      Parameters

      • options: ParserOptions

        The parser options.

      • format: FormatOptions

        The formatting options.

      • field: string

        The header field name.

      • rawValue: Uint8Array

        The raw header value bytes.

      Returns Uint8Array

      The reformatted raw value bytes, or the original bytes if parsing fails.

    • Parses a header from text or bytes.

      Parameters

      • input: string | Uint8Array<ArrayBufferLike>

        The input to parse.

      • options: ParserOptions = ParserOptions.default

        The parser options.

      • startIndex: number = 0

        The starting index of the input.

      • Optionallength: number

        The number of bytes to parse.

      Returns Result<Header>

      A Result; { ok: false } with a MimeError on malformed input.

      input is null or undefined.

      startIndex or length is out of range.