tentwentyfour / nextcloud-link

Javascript/Typescript client that communicates with Nextcloud's WebDAV and OCS APIs
MIT License
56 stars 7 forks source link

Downloaded image using get / downloadToStream is broken #48

Closed mfachmirizal closed 2 years ago

mfachmirizal commented 2 years ago

Hello, I have some image files on NextCloud. I tried to get the image using:

await client.get('/newUpload/uploaded.jpg'); and await client.downloadToStream('/newUpload/uploaded.jpg', fs.createWriteStream('D:\\targetdir\\uploaded.jpg'));

but both of them returning broken image. corupted

How can I get my image file properly?

or is there anyway to get the direct image url ?, Because I need to show my uploaded image to my web.

Thanks

kwisatz commented 2 years ago

Hi @mfachmirizal,

get failing is a known issue (#39) however, we've not yet seen downloadToStream failing. On the other hand, we have never tested this on Windows. How are you running this, as an electron app, pre-packaged, in a shell (which one?).

Could you perhaps share more details with us (such as the command line or runtime you're using) and ideally a minimal but functional example that fails?

mfachmirizal commented 2 years ago

Hi @mfachmirizal,

get failing is a known issue (#39) however, we've not yet seen downloadToStream failing. On the other hand, we have never tested this on Windows. How are you running this, as an electron app, pre-packaged, in a shell (which one?).

Could you perhaps share more details with us (such as the command line or runtime you're using) and ideally a minimal but functional example that fails?

Hello @kwisatz, Im running this as node js application. trying to make backendservice for upload and show image via nextcloud.

for beginning I just create simply node js project for testing upload/retrieve image with this package. The upload is success, but when I want to retrieve the image, it always corrupted. Thankyou

mfachmirizal commented 2 years ago

Ahh sorry my bad, the upload process is failed in the first place... it's uploaded broken image. I'm really sorry for this thankyou