DEV Community

Cover image for The Blob Data Type
Ian Iversen
Ian Iversen

Posted on

The Blob Data Type

There are varying data types that exist in the world of programming. Common data types include: strings, integers, floats, characters, booleans. All of these data types can be used along with tables and data to create rich and expressive databases for web apps. But what can developers do if they would like to use images, video, or audio?

ENTER type:blob

Image description

A blob data type is used for storing information in databases just like a string or an integer. However, blobs can store binary data which allows for the storage of files. Images, videos and audio can then be stored in databases as blobs.

The term "blob" actually stands for "Binary Large Object" and is used for storing information, as binary, in databases.

Through the use of blobs, common social media features such as photo albums can be constructed where a photo album table would contain photos:blob and photo_caption:string.

Because blobs are used to store objects such as images, audio files, and video clips, they often require significantly more space than other data types. The amount of data a blob can store varies depending on the database type, but some databases allow blob sizes of several gigabytes.

Example

{
  "data" : {
    "image": "/9j/4AAQSkZJRgABAQEAYABgAAD//gA7Q1JFQVRPUjogZ2===",
  },
  "time": <Optional Timestamp>,
  "flowVersion": <Optional Workflow Version Name>
}
Enter fullscreen mode Exit fullscreen mode

Image description

How to record and play audio in JavaScript:

https://medium.com/@bryanjenningz/how-to-record-and-play-audio-in-javascript-faa1b2b3e49b

How can I get the blob file (i.e recorder voice) to send the server:

https://github.com/mattdiamond/Recorderjs/issues/188

Image description

Sources:
https://techterms.com/definition/blob
https://en.wikipedia.org/wiki/Binary_large_object
https://docs.losant.com/devices/blobs/

Top comments (0)