How to put attachments into a bucket using the Node.js API?

Hello experts,

I'm trying to transfer some image files of thumbnails (one per CB document) to the iOS app that I'm writing.

I'm entering documents into my main bucket using the Node.js API, and the data gets synced to the iOS devices using the CB Sync Gateway and CBL.

I've seen that there are ways to add attachments to CB documents, or to save binary data as Base64-encoded strings.

I couldn't find anything in the Node.js API that suggested that attachments are supported, so please give me some pointers.

What would be the best way to transfer small files to the iOS devices?

I've seen that Connection.set(...) can take a value of type Buffer. Would that help me to achieve my goal?


I've posted a similar question before but it wasn't answered... that's why I'm posting this in the hope that the slight rephrasing helps it getting an answer.

1 Answer

« Back to question.

I think what you are looking for is actually something like this. Basically this code stores an image captured in the browser and stores it in Couchbase. Works pretty nicely!