3 ms·
If you want to place binary data in CouchDB that's entirely possible. However, you have to create a document and then add an attachment to it. Attachments thems
by daenney 10y ago
If you want to place binary data in CouchDB that's entirely possible. However, you have to create a document and then add an attachment to it. Attachments themselves can have multiple revisions.
When PUTing[1] the attachment the appropriate Content-Type header is required to be set. If both of these things are done properly I see no obvious reason as to why they'd run into the encoding issue mentioned. Which makes me suspect it's not properly using the attachment feature or not correctly setting the MIME type.
Or they're doing something weird when grabbing the binary data from the user, like not using FileReader.readAsArrayBuffer()[2] from their JS code and instead getting it as text. readAsArrayBuffer is specifically designed to deal with binary data, usually used with images in web context.
[1]: http://docs.couchdb.org/en/2.0.0/api/document/attachments.html http://docs.couchdb.org/en/2.0.0/api/document/attachments.ht...
[2]: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsArrayBuffer https://developer.mozilla.org/en-US/docs/Web/API/FileReader/...