Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added changes for enhancements in blob docs #40

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/DataSync/remote-sync-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar_position: 2

# Remote Sync Gateway

> Description - _Couchbase Lite for Swift — Synchronizing data changes between local and remote databases using Sync Gateway_
> Description - _Couchbase Lite for Ionic — Synchronizing data changes between local and remote databases using Sync Gateway_

:::note
All code examples are indicative only. They demonstrate the basic concepts and approaches to using a feature. Use them as inspiration and adapt these examples to best practice when developing applications for your platform.
Expand Down
16 changes: 16 additions & 0 deletions docs/blobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ document.setBlob('avatar', avatarBlob);
await collection.save(document);
```

#### Example 2. Get Blob's content

```typescript
// code for setting blob
const encoder = new TextEncoder();
const blobEncoded = new Blob("text/plain", encoder.encode("Hello World"));
doc.setBlob('textBlob', blobEncoded);

// code for getting blob's content
const textDecoder = new TextDecoder();
const blobArrayBuffer = await doc.getBlobContent('textBlob', collection);
const textBlobResults = textDecoder.decode(blobArrayBuffer);
```
azaddhirajkumar marked this conversation as resolved.
Show resolved Hide resolved

## Syncing

When a document containing a blob object is synchronized, the Couchbase Lite replicator generates an `_attachments` dictionary with an auto-generated name for each blob attachment. This is different to the `avatar` key and is used internally to access the blob content.
Expand Down Expand Up @@ -93,3 +107,5 @@ If you view a sync'd blob document in either Capella's Admin Interface or Couchb