@couchbase/lite-js
    Preparing search index...

    Class NewBlob

    A newly-created Blob that hasn't been saved yet. You can create instances and add them to a CBLDocument's body, at top-level or nested. When the document is saved, the data (contents) will be saved in the database separately from the document, loadable on demand via the getContents method; and this object will be replaced with an equivalent ExistingBlob object.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    • Constructs a NewBlob.

      Parameters

      • contents: Uint8Array

        The raw data. Will be moved into the database when the document is saved. The constructor makes a copy of this, so any modifications afterwards will be ignored.

      • Optionalcontent_type: string

        MIME type of the contents; this is optional.

      Returns NewBlob

    Properties

    content_type?: string

    Optional MIME type of the contents. (Couchbase Lite doesn't use this, except as a hint for whether to compress the contents during sync.)

    digest: string

    The unique digest, usually SHA-1, of the blob's contents.

    length?: number

    Length in bytes of the contents.

    revpos?: number

    Used internally by Sync Gateway; you can ignore it.

    Accessors

    • get contents(): Uint8Array

      For convenience, a non-async accessor for the contents.

      Returns Uint8Array

    Methods

    • Asynchronously returns the blob's data as a UInt8Array.

      Returns Promise<Uint8Array<ArrayBufferLike>>