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

    Class TextPart

    A MIME part containing text content.

    TextPart handles plain text, flowed text, HTML, enriched text, and rich text bodies and decodes their content using the declared or detected charset.

    Hierarchy (View Summary)

    Index
    headers: HeaderList

    The headers belonging to this MIME entity.

    contentType: ContentType

    The entity's Content-Type value.

    ensureNewLine: boolean = false
    lazyLoaded: Set<LazyField> = ...
    content: MimeContent | null = null

    The MIME content for this part.

    • get isDisposed(): boolean

      C#: internal IsDisposed (exposed publicly; upstream tests read it via InternalsVisibleTo).

      Returns boolean

    • get isAttachment(): boolean

      Gets or sets whether this entity is marked as an attachment.

      Setting this updates the Content-Disposition disposition between attachment and inline.

      Returns boolean

    • set isAttachment(value: boolean): void

      Sets whether this entity is marked as an attachment.

      Parameters

      • value: boolean

      Returns void

    • get contentDescription(): string | null

      Gets or sets the Content-Description header value.

      Returns string | null

      The part has been disposed.

    • set contentDescription(value: string | null): void

      Sets the Content-Description header value.

      Parameters

      • value: string | null

      Returns void

    • get contentDuration(): number | null

      Gets or sets the Content-Duration value in seconds.

      Returns number | null

      value is not a non-negative integer.

      The part has been disposed.

    • set contentDuration(value: number | null): void

      Sets the Content-Duration value in seconds.

      Parameters

      • value: number | null

      Returns void

    • get contentMd5(): string | null

      Gets or sets the Content-MD5 checksum value.

      Returns string | null

      The part has been disposed.

    • set contentMd5(value: string | null): void

      Sets the Content-MD5 checksum value.

      Parameters

      • value: string | null

      Returns void

    • get contentTransferEncoding(): ContentEncoding

      Gets or sets the Content-Transfer-Encoding value.

      Returns ContentEncoding

      value is not a valid content encoding or the part has been disposed.

    • set contentTransferEncoding(value: ContentEncoding): void

      Sets the Content-Transfer-Encoding value.

      Parameters

      Returns void

    • get isEnriched(): boolean

      Gets whether this part is text/enriched or text/richtext.

      Returns boolean

    • get isFlowed(): boolean

      Gets whether this part is flowed plain text.

      Returns boolean

    • get isHtml(): boolean

      Gets whether this part is HTML text.

      Returns boolean

    • get isPlain(): boolean

      Gets whether this part is plain text.

      Returns boolean

    • get isRichText(): boolean

      Gets whether this part is rich text.

      Returns boolean

    • get text(): string

      Gets or sets the decoded text using UTF-8 when setting.

      Returns string

    • set text(value: string): void

      Sets the text content using UTF-8.

      Parameters

      • value: string

      Returns void

    • C#: MimeEntity.Load. Parses a MIME entity from a stream (or byte buffer), or — given an explicit Content-Type — from a bare content stream (the HttpWebResponse use-case, where headers are parsed separately). Parse errors are returned as an Err (C#: FormatException) per the port's Result convention.

      Parameters

      Returns Result<MimeEntity>

    • C#: MimeEntity.Load. Parses a MIME entity from a stream (or byte buffer), or — given an explicit Content-Type — from a bare content stream (the HttpWebResponse use-case, where headers are parsed separately). Parse errors are returned as an Err (C#: FormatException) per the port's Result convention.

      Parameters

      Returns Result<MimeEntity>

    • C#: MimeEntity.Load. Parses a MIME entity from a stream (or byte buffer), or — given an explicit Content-Type — from a bare content stream (the HttpWebResponse use-case, where headers are parsed separately). Parse errors are returned as an Err (C#: FormatException) per the port's Result convention.

      Parameters

      Returns Result<MimeEntity>

    • Calculates the best content-transfer-encoding for this part.

      Parameters

      • constraint: EncodingConstraint

        The encoding constraint.

      • maxLineLength: number = DEFAULT_MAX_LINE_LENGTH

        The maximum line length.

      Returns ContentEncoding

      The best content-transfer-encoding.

    • Computes a base64-encoded MD5 checksum for the decoded content.

      Returns string

      The computed checksum.

      The part has no content or has been disposed.

    • Verifies the Content-MD5 checksum against the decoded content.

      Returns boolean

      true if the checksum matches; otherwise false.

    • Prepares this part for transport under the requested encoding constraint.

      Parameters

      • constraint: EncodingConstraint

        The encoding constraint.

      • maxLineLength: number = DEFAULT_MAX_LINE_LENGTH

        The maximum encoded line length.

      Returns void

      maxLineLength is outside the supported range.

    • Parameters

      • action: "changed" | "removed" | "added" | "cleared"
      • header: Header | null

      Returns void

    • Tests whether this part matches a text format.

      Parameters

      Returns boolean

      true if this part matches format; otherwise false.

    • Gets the decoded text.

      Returns { text: string; encoding: CharsetEncoding }

      The decoded text, or the decoded text with the detected encoding.

      The charset is unsupported or the part has been disposed.

    • Gets the decoded text.

      Parameters

      Returns string

      The decoded text, or the decoded text with the detected encoding.

      The charset is unsupported or the part has been disposed.

    • Gets the decoded text.

      Parameters

      • charset: string

        The charset name to use.

      Returns string

      The decoded text, or the decoded text with the detected encoding.

      The charset is unsupported or the part has been disposed.

    • Sets the text content using the specified charset.

      Parameters

      • charset: string | CharsetEncoding

        The charset name or encoding.

      • text: string

        The text content.

      Returns void

      charset or text is null, or the charset is unsupported.