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

    Class Component

    A part component (of a multipart).

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Create a new Component instance

      Parameters

      • headers: HeadersInit

        The headers of the component

      • Optionalbody: null | ArrayBuffer | ArrayLike<number>

        The body of the component. Defaults to empty if null or undefined.

      Returns Component

    Properties

    The byte data of this part's body

    headers: Headers

    The headers of this part

    Methods

    • Create a Component from a Blob. If blob media type is available, it will be set in the Content-Type header. The blob's contents will be used as the part's body.

      This method might be slow if a large file is provided as the blob contents need to be read.

      Parameters

      • blob: Blob

        Blob to create the component from

      Returns Promise<Component>

    • Create a Component from a File. If file media type is available, it will be set in the Content-Type header. The file's contents will be used as the part's body.

      This method might be slow if a large file is provided as the file contents need to be read.

      Parameters

      • file: File

        File instance to create the component from

      Returns Promise<Component>

      Use Component.blob.