首页 > 解决方案 > Couchbase Sync 网关 - 文件上传为附件

问题描述

如何使用 Sync-gateway 从节点 js 将图像文件上传到沙发库

上传后的沙发基础图像文档应如下所示

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

注意:Couchbase 版本是 Community Edition 5.0.0

标签: node.jscouchbasecouchbase-sync-gateway

解决方案


你的沙发底座和 SGW 的版本是什么?插入附件的正确形式是 throw Sync gateway
you need check REST API Sync gateway in the documentation of couchbase

以其他方式,您可以尝试在 base 64 中转换图像并使用字符串在文档中设置一个字段 this throw SDK for NODE JS


推荐阅读