Represents an attachment and can be used to insert the associated attachment into a document at a specific key-path. You can't instantiate an attachment directly, please use the ditto.store.newAttachment() method instead.

Accessors

  • get id(): string
  • The attachment's ID.

    Returns string

  • get len(): number | BigInt
  • The attachment's size given as number of bytes.

    Returns number | BigInt

  • get metadata(): {
        [key: string]: string;
    }
  • The attachment's metadata.

    Returns {
        [key: string]: string;
    }

    • [key: string]: string

Methods

  • Copies the attachment to the specified file path. Node-only, throws in the browser.

    Parameters

    • path: string

      The path that the attachment should be copied to.

    Returns Promise<void>

  • Returns the attachment's data.

    Returns Promise<Uint8Array>

  • Returns the attachment's data.

    Returns Promise<Uint8Array>

    Deprecated

    Use data() instead.