Instance Method
downloadAttachment(dbName:docId:attachmentName:eventLoopGroup:)
Downloads an attachment from a CouchDB document.
func downloadAttachment(dbName: String, docId: String, attachmentName: String, eventLoopGroup: (any EventLoopGroup)? = nil) async throws -> Data
Parameters
- dbName
The database name.
- docId
The document ID.
- attachmentName
The name of the attachment.
- eventLoopGroup
Optional EventLoopGroup for network operations.
Return Value
The binary data of the attachment.
Discussion
Throws
CouchDBClientError on failure.
Example Usage:
let attachmentData = try await couchDBClient.downloadAttachment(
dbName: "myDatabase",
docId: "docid",
attachmentName: "image.png"
)
print("Downloaded attachment, size: \(attachmentData.count) bytes")