Closed adrienverge closed 4 years ago
See documentation at https://docs.couchdb.org/en/stable/api/document/attachments.html
I choose not to cache data in the class, contrary to Document objects, because attachments can be very large.
Document
For that reason, and for simplicity, file contents are returned directly from Attachment.fetch(), and are sent directly to .save().
Attachment.fetch()
.save()
The API currently looks like this:
att = doc.attachment("file.webp") await att.save(binary, "image/webp") att = doc.attachment("other.html") data = await att.fetch() content_type = att.content_type await att.delete()
Criticism and good ideas are welcome!
Closes #18.
Thanks for the fast review. I've updated the commit accordingly.
IIRC content_type is a member variable, so no need for await?
Sure, sorry, it was a typo.
See documentation at https://docs.couchdb.org/en/stable/api/document/attachments.html
I choose not to cache data in the class, contrary to
Document
objects, because attachments can be very large.For that reason, and for simplicity, file contents are returned directly from
Attachment.fetch()
, and are sent directly to.save()
.The API currently looks like this:
Criticism and good ideas are welcome!
Closes #18.