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

    Class HeaderList

    Represents a list of message headers.

    Implements

    Index
    options: ParserOptions

    The parser options associated with headers in this list.

    onChanged: HeaderListChangedCallback | null = null

    Invoked when the header list changes.

    hasBodySeparator: boolean = true

    Whether a body separator should be written after the headers.

    • get isReadOnly(): boolean

      Whether this list is read-only.

      Returns boolean

    • Gets the header at the specified index.

      Parameters

      • index: number

        The index.

      Returns Header

      The header.

      index is out of range.

    • Replaces the header at the specified index.

      Parameters

      • index: number

        The index.

      • value: Header

        The replacement header.

      Returns void

      value is null or undefined.

      index is out of range.

    • Gets the value of the first matching header.

      Parameters

      • idOrField: string

        The header identifier or field name.

      Returns string | null

      The header value, or null if it does not exist.

    • Sets the value of the first matching header, adding it if it does not exist.

      Parameters

      • idOrField: string

        The header identifier or field name.

      • value: string

        The header value.

      Returns void

      value is null or undefined.

    • Adds a header to the list.

      Parameters

      • ...args: HeaderListAddArgs

        A header instance, or a field/id with value and optional charset.

      Returns void

    • Determines whether the list contains the specified header or field.

      Parameters

      • value: string | Header

        The header, header identifier, or field name.

      Returns boolean

      true if the header is contained; otherwise, false.

      value is null or undefined.

    • Copies the headers to an array.

      Parameters

      • array: Header[]

        The destination array.

      • arrayIndex: number

        The index into the array.

      Returns void

      array is null or undefined.

      arrayIndex is out of range or the array is too small.

    • Gets the index of the first matching header.

      Parameters

      • value: string | Header

        The header, header identifier, or field name.

      Returns number

      The header index, or -1 if it is not found.

      value is null or undefined.

    • Inserts a header at the specified index.

      Parameters

      • ...args: HeaderListInsertArgs

        The index and a header instance, or a field/id with value and optional charset.

      Returns void

      The index is out of range.

    • Gets the index of the last matching header.

      Parameters

      • value: string

        The header identifier or field name.

      Returns number

      The header index, or -1 if it is not found.

      value is null or undefined.

    • Removes the first matching header.

      Parameters

      • value: string | Header

        The header, header identifier, or field name.

      Returns boolean

      true if a header was removed; otherwise, false.

      value is null or undefined.

    • Removes all headers matching the specified field.

      Parameters

      • value: string

        The header identifier or field name.

      Returns void

      value is null or undefined.

    • Removes the header at the specified index.

      Parameters

      • index: number

        The index.

      Returns void

      index is out of range.

    • Replaces all matching headers with a single header.

      Parameters

      • ...args: HeaderListAddArgs

        A header instance, or a field/id with value and optional charset.

      Returns void

    • Attempts to get the first matching header.

      Parameters

      • value: string

        The header identifier or field name.

      Returns Header | null

      The header, or null if it does not exist.

    • Writes the headers to a stream.

      Parameters

      • stream: Stream

        The output stream.

      Returns void

      stream is null or undefined.

    • Writes the headers to a stream using the specified formatting options.

      Parameters

      Returns void

      options or stream is null or undefined.