Hyperblob Icon

What is a HyperBlob™?

A HyperBlob is a special key in your schema that is capable of storing binary and/or text data. This data is then available to people that access your database via a global CDN.


Getting Started

Working with binary data or files that are too large to fit in a key should not be difficult. To solve this, we have designed a feature we call HyperBlobs (HB).

Please keep in mind that HBs database APIs that are designed for the cloud. Local calls at the moment do not support HBs.

The first thing that must be done before using HBs is to open up LCM and define which keys in your schema are to be treated as HBs. Simply click the drop down next to your key and select ‘HyperBlob’.

Save your changes and export your SDK to your application under development.

Saving HyperBlobs

To save a HB, use any of the APIs that store data. In this example, we have a database named ‘clients’. We have the following keys in this database: firstName, lastName, picture:hyperblob.

We are going to store the following data: John, Doe, {picture data}
HyperBlobs can be saved by passing a file path to the data or by populating a variable with the data to be stored. You will get a performance boost by using the file path method instead of populating a variable due to reduced memory usage.

put "John" into tDataA["firstName"]
put "Doe" into tDataA["lastName"]
put tPathToImage into tDataA["picture:hyperblob"]
put cdb_createCloudRecord(tDataA,"clients") into tRecordID

The cdb_createCloudRecord will return the recently created tRecordID: 2fc09a22-d441-4939-87f0-a59ad9d3603b

If you look at this record in the LCM, you will find a token stored in the picture:hyperBlob key. You can use this token to get your HB at any time.

Getting HyperBlobs

We are now going to retrieve our HB from the previous save.

First, we need to get the HB ID from a stored record.

put cdb_lookUpCloudValue("2fc09a22-d441-4939-87f0-a59ad9d3603b","picture:hyperblob","clients") into tBlobID
put cdb_getHyperBlob(tBlobID,"clients") into image "clientPicture"

// OR

put cdb_getHyperBlob(tBlobID,"clients") into url("binFile:myImage" & tDataA["blobExtension"])

// OR

put cdb_getHyperBlob(tBlobID,"clients") into tBinaryVariable

 

Deleting HyperBlobs

We can easily delete a given HB by storing an empty value in the HB key and calling one of the save/create APIs.

put empty into tDataA["picture:hyperBlob"]
put "2fc09a22-d441-4939-87f0-a59ad9d3603b" into tDataA["cdbRecordID"]
put cdb_createCloudRecord(tDataA,"clients") into tRecordID

Deleting an entire record also deletes the HyperBlob.

cdb_deleteCloudRecord "2fc09a22-d441-4939-87f0-a59ad9d3603b","clients"