BLOB type (TypeScript)

Use the blob type for binary data.

Although you can store binary-encoded vector data in a blob column, you cannot create a vector index or perform a vector search on the column. Instead, use the vector type to store vector data.

Due to a known issue with filtering on blob, DataStax does not recommend using blob in primary keys.

You can insert binary data as a DataAPIBlob object. The DataAPIBlob class and its blob shorthand accept DataAPIBlobLike input, such as ArrayBuffer and { $binary: string }.

The TypeScript client returns binary data received from the Data API as a DataAPIBlob object. The DataAPIBlob class provides methods like asArrayBuffer() for accessing the binary data.

import { DataAPIClient, DataAPIBlob } from "@datastax/astra-db-ts";

// Get an existing table
const client = new DataAPIClient();
const database = client.db("API_ENDPOINT", {
  token: "APPLICATION_TOKEN",
});
const table = database.table("TABLE_NAME");

// Insert binary values
(async function () {
  const result = await table.insertOne({
    example_blob: new DataAPIBlob({ $binary: "PfvnbT7peNU/Sfvn" }),
    another_example_blob: new DataAPIBlob(Buffer.from([0x0, 0x1, 0x2])),
    title: "Example",
  });
})();

Was this helpful?

Give Feedback

How can we improve the documentation?

© Copyright IBM Corporation 2026 | Privacy policy | Terms of use Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: Contact IBM