How do i load/import/insert a binary object(like a pdf/html document) into couchbase bucket

Hello everyone !

First and foremost, thanks in advance for all your help.

I have a requirement to store various files like pdf/ppt/.doc/html as binary data (i.e. blob) into couchbase. I am new to couchbase and have been looking for a utility like ‘cbimport’ to load the binary data. Please help me into the right direction.

Thanks again !!

SV

welcome @veerasr!

So, first to give you a technical answer to your question, check out the cbc tools which are distributed with libcouchbase. There is an older blog which intros them.

One of those is cbc cp, and using it you can “copy” a binary into a binary item. You can technically do that with an entire directory of binaries. The source is available, of course. All of the SDKs also support loading such binary items.

Now, having said that, you probably need to think through this a bit more from a data access perspective. Do you need to store the file/mime type? Are you going to need to get any metadata without accessing the entire binary? Things of that nature. cbc cp just loads the data and the filename. It meets the strict definition of what you’re looking for, but you’ll probably need something more in most cases.

Thanks so much ingenthr for your feedback. I will explore the suggested option, ‘cbc cp’. I am planning to build another bucket with all the pertaining metadata of the binary objects. Please let me know if the data retrieval of these binary objects stored in couchbase work without any issues.

thanks again for all your help.