Search code examples
node.jscouchbasecouchbase-sync-gateway

Couchbase Sync gateway - File upload as attachment


How can i upload an image file to couchbase from node js using Sync-gateway

The couchbase image document should look like below format after upload

>  "_attachments": {
>         "blahblahblah.jpeg": {
>           "content_type": "image/jpg",
>           "digest": "blahblahblah",
>           "length": 99999,
>           "revpos": 1,
>           "stub": true
>         }

NB: Couchbase version is Community Edition 5.0.0


Solution

  • what is the version of your couchbase and SGW? the correct form for inserting attachments is throw Sync gateway
    you need check REST API Sync gateway in the documentation of couchbase

    in other way you can try convert image in base 64 and set a field in document with string this throw SDK for NODE JS