CouchdbClient.Attachment
Add, delete and retrieve attachments to/from a document
Summary
Functions
Adds attachment to document. Default content_type is “text/plain;content=utf8”. Returns :ok
Removes attachment from document. Returns :ok
Retrieves attachment from document. Returns { content, content_type }
Returns the URL of an attachments, including revision query parameter. If the document hasn’t been retrieved yet, a Document.get_rev (HEAD call to CouchDB) will be performed to retrieve the current revision identifier “rev”
Functions
Adds attachment to document. Default content_type is “text/plain;content=utf8”. Returns :ok
If you wish to work further on this document you MUST call Document.load afterwards to update stubs and data.rev
Examples:
CouchdbClient.Attachment.attach(
document, %{ filename: "test.txt", content: "Äktschn!" }, db
)
CouchdbClient.Attachment.attach(
document,
%CouchdbClient.Attachment{
filename: "test.jpeg",
content: File.read!("/home/gutschilla/test.jpeg"),
content_type: "image/jpeg"
},
db
)