Represents a blob column for Data API tables.

See DataAPIBlobLike for the types that can be converted into a DataAPIBlob.

You may use the blob function as a shorthand for creating a new DataAPIBlob.

See the official DataStax documentation for more information.

Implements

Constructors

  • Creates a new DataAPIBlob instance from a blob-like value.

    You can set validate to false to bypass any validation if you're confident the value is a valid blob.

    Parameters

    • blob: DataAPIBlobLike

      The blob-like value to convert to a DataAPIBlob

    • validate: boolean = true

      Whether to validate the blob-like value (default: true)

    Returns DataAPIBlob

    Throws

    TypeError If blob is not a valid blob-like value

Properties

#raw: ArrayBuffer | Buffer | {
    $binary: string;
}

Type declaration

  • $binary: string

Accessors

  • get byteLength(): number
  • Gets the byte length of the blob, agnostic of the underlying type.

    Returns number

    The byte length of the blob

Methods

  • Returns the blob as an ArrayBuffer, converting between types if necessary.

    Returns ArrayBuffer

    The blob as an ArrayBuffer

  • Returns the blob as a base64 string, converting between types if necessary.

    Returns string

    The blob as a base64 string

  • Returns the blob as a Buffer, if available, converting between types if necessary.

    Returns Buffer

    The blob as a Buffer

  • Gets the raw underlying implementation of the blob.

    Returns ArrayBuffer | Buffer | {
        $binary: string;
    }

    The raw blob