![]() |
Couchbase Lite
Objective-C API for iOS and Mac OS
|
A binary attachment to a document revision.
Existing attachments can be gotten from -[CBLRevision attachmentNamed:]. New attachments can be created by calling the -setAttachment:... methods of CBLNewRevision or CBLModel.
Instance Methods | |
| (nullable NSInputStream *) | - openContentStream |
| Returns a stream from which you can read the data of the attachment. More... | |
| (BOOL) | - purge |
| Deletes the attachment's contents from local storage. More... | |
| (instancetype) | - NS_UNAVAILABLE |
Properties | |
| CBLRevision * | revision |
| The owning document revision. More... | |
| CBLDocument * | document |
| The owning document. More... | |
| NSString * | name |
| The filename. More... | |
| NSString * | contentType |
| The MIME type of the contents. More... | |
| UInt64 | length |
| The length in bytes of the contents. More... | |
| UInt64 | encodedLength |
| The length in bytes of the encoded form of the attachment. More... | |
| CBLJSONDict * | metadata |
| The Couchbase Lite metadata about the attachment, that lives in the document. More... | |
| BOOL | contentAvailable |
| Is the content locally available? This may be NO if the attachment's document was pulled from a remote database by a CBLReplication whose downloadAttachments property was NO. More... | |
| NSData * | content |
| The data of the attachment. More... | |
| NSURL * | contentURL |
| The (file:) URL of the file containing the contents. More... | |
| - (nullable NSInputStream*) openContentStream |
Returns a stream from which you can read the data of the attachment.
Remember to close it when you're done.
| - (BOOL) purge |
Deletes the attachment's contents from local storage.
If the attachment is still available on a remote server, it can be restored by calling -[CBLReplication downloadAttachment:onProgress:].
| - (instancetype) NS_UNAVAILABLE |
|
readatomicretain |
The owning document revision.
|
readatomicassign |
The owning document.
|
readatomiccopy |
The filename.
|
readatomicassign |
The MIME type of the contents.
|
readatomicassign |
The length in bytes of the contents.
|
readatomicassign |
The length in bytes of the encoded form of the attachment.
This may be smaller than the length if the attachment is stored in compressed form.
|
readatomicassign |
The Couchbase Lite metadata about the attachment, that lives in the document.
|
readatomicassign |
Is the content locally available? This may be NO if the attachment's document was pulled from a remote database by a CBLReplication whose downloadAttachments property was NO.
If so, the content accessors will return nil. The attachment can be downloaded by calling the replication's -downloadAttachment:onProgress: method.
|
readatomicassign |
The data of the attachment.
|
readatomicassign |
The (file:) URL of the file containing the contents.
This property is somewhat deprecated and is made available only for use with platform APIs that require file paths/URLs, e.g. some media playback APIs. Whenever possible, use the content property or the openContentStream method instead. The file must be treated as read-only! DO NOT MODIFY OR DELETE IT. If the database is encrypted, attachment files are also encrypted and not directly readable, so this property will return nil.