multipart-ts - v1.4.1
    Preparing search index...

    Class Multipart

    A collection of Parts

    Implements

    Index

    Constructors

    • Create a new Multipart instance

      Parameters

      • parts: Part[]

        The parts to include in the multipart

      • Optionalboundary: string | Uint8Array<ArrayBufferLike> = ...

        The multipart boundary used to separate the parts. Randomly generated if not provided

      • OptionalmediaType: string = "multipart/mixed"

        The media type of the multipart. Defaults to "multipart/mixed"

      Returns Multipart

    Properties

    headers: Headers = ...

    The headers of this multipart

    parts: Part[]

    The parts to include in the multipart

    Accessors

    • get body(): Uint8Array<ArrayBuffer>

      Get the bytes of the body of this multipart. Includes all parts separated by the boundary. Does not include the headers.

      Returns Uint8Array<ArrayBuffer>

      RangeError If the multipart boundary is invalid. A valid boundary is 1 to 70 characters long, does not end with space, and may only contain: A-Z a-z 0-9 '()+_,-./:=? and space

    • get mediaType(): string

      The media type of the multipart

      Returns string

      "multipart/mixed"
      
      "multipart/form-data"
      
      "multipart/byteranges"
      
    • set mediaType(mediaType: string): void

      Parameters

      • mediaType: string

      Returns void

    Methods

    • Create Blob from this multipart.

      Returns Blob

      RangeError If the multipart boundary is invalid. A valid boundary is 1 to 70 characters long, does not end with space, and may only contain: A-Z a-z 0-9 '()+_,-./:=? and space.

    • Create FormData from this multipart. Only parts that have Content-Disposition set to form-data and a non-empty name will be included.

      Returns FormData

    • Parse multipart bytes (including headers). The boundary and media type are determined from the headers.

      Parameters

      • data: Uint8Array

        Byte representation of the multipart headers and body

      Returns Multipart

      SyntaxError If the Content-Type header is missing or does not include a boundary

    • Create Multipart from a Part. The boundary and media type are determined from the part's headers.

      Parameters

      Returns Multipart

      SyntaxError If the Content-Type header is missing or does not include a boundary