Blob
A Couchbase Lite Blob. A Blob appears as a property of a Document and contains arbitrary binary data, tagged with MIME type. Blobs can be arbitrarily large, although some operations may require that the entire content be loaded into memory. The containing document's JSON contains only the Blob's metadata (type, length and digest). The data itself is stored in a file whose name is the content digest (like git).
Constructors
Construct a Blob with the given stream of data. The passed stream will be closed when it is copied either to memory (see getContent
) or to the database. If it is closed before that, by client code, the attempt to store the blob will fail. The converse is also true: the stream for a blob that is not saved or copied to memory will not be closed (except during garbage collection).
Construct a Blob with the content of a file. The blob can then be added as a property of a Document. This constructor creates a stream that is not closed until the blob is stored in the db, or copied to memory (except by garbage collection).
Types
Properties
Get the contents of this blob as a stream. The caller is responsible for closing the stream returned by this call. Closing or deleting the database before this call completes may cause it to fail. When called on a blob created from a stream (or a file path), this method will return null!
The type of the content this blob contains. By convention this is a MIME type.
The blob metadata