Skip to content

[@triniwiz/nativescript-couchbase] when using getBlob I get an empty object back #52

Open
@Itzme83

Description

@Itzme83

Hi,

I am not sure if I am doing something wrong or there is a bug which causes this behaviour. I took your demo code and added a new document via the "addItem" function which worked fine. A new document was added to my bucket and the attachment too. Then I wrote the following function to check the response of "getBlob":

getItem() {
    let document = this.db.getDocument("8a5349ce-9693-44aa-a636-5e6a2c4c48e1");

    console.log('document', document);

    let blob = this.db.getBlob("8a5349ce-9693-44aa-a636-5e6a2c4c48e1","image");

    console.log('blob',blob);
} 

The output of the console.log:

JS: document {
JS:   "id": "8a5349ce-9693-44aa-a636-5e6a2c4c48e1",
JS:   "revisionID": "2-929ca4eb1b2c4def2b458614a805b687af5f5287",
JS:   "title": "",
JS:   "created_at": "2021-05-17T13:04:51.043Z",
JS:   "image": null
JS: }
JS: blob {}

After this I checked the function "getBlob" in index.android.js of the plugin and added there a console.log too to check if the object there is empty too:

getBlob(id, name) {
    let document = this.android.getDocument(id);
    if (!document)
        return null;
    const blob = document.getBlob(name);
    console.log('blob', blob);
    if (!blob)
        return null;
    return new Blob(blob);
}

The output was:

JS: blob Blob{@0x908ca92,type=image/png,len=5109}

And now I am confused if there is a bug in the plugin or I am doing something wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions