Create a new Multipart instance
The parts to include in the multipart
Optional
boundary: string | Uint8Array<ArrayBufferLike> = ...The multipart boundary used to separate the parts. Randomly generated if not provided
Optional
mediaType: string = "multipart/mixed"The media type of the multipart. Defaults to "multipart/mixed"
Readonly
headersThe headers of this multipart
Readonly
partsThe parts to include in the multipart
Get the bytes of the body of this multipart. Includes all parts separated by the boundary. Does not include the headers.
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 the boundary bytes used to separate the parts
Set the boundary bytes used to separate the parts
Create Blob from this multipart.
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 the bytes of the headers and body of this multipart.
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.
Static
blobCreate Multipart from a Blob. The boundary and media type are determined from the blob's type.
The blob
SyntaxError If the Content-Type
header is missing or does not include a boundary
Static
formCreate Multipart from FormData. This method might be slow if the form data contains large files.
Form data
Optional
boundary: string | Uint8Array<ArrayBufferLike>Multipart boundary to use to separate the parts. If not provided, a random boundary will be generated.
Static
parseParse multipart bytes (including headers). The boundary and media type are determined from the headers.
Byte representation of the multipart headers and body
SyntaxError If the Content-Type
header is missing or does not include a boundary
Static
parseParse multipart body data
Multipart body bytes
The multipart boundary bytes used in the body bytes to separate the parts
Optional
mediaType: stringMultipart media type to pass to the constructor
Static
partCreate Multipart from a Part. The boundary and media type are determined from the part's headers.
The part
SyntaxError If the Content-Type
header is missing or does not include a boundary
A collection of Parts