You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

dgtal box's avatar
dgtal box
Explorer | Level 3
8 months ago

Download files from shared link using javascript

...
await new Promise<void>((resolve, reject) => {
 const file = createWriteStream(filePath);
 https.get(createAudioLibraryCard.basicInfo.sharedLink, response => {
  response.pipe(file);
  file.on('finish', () => {
   file.close();
   resolve();
   });
  }).on('error', err => {
   fs.unlink(filePath, () => reject(err)); // Delete the file asynchronously on error
 });
});
...
The above code downloads for other content links. 
a sample link as bellow:

https://st2.depositphotos.com/1743476/11581/i/950/depositphotos_115812486-stock-photo-pride-man-smiling.jpg
But, it doesn't download for a dropbox shared link.
https://www.dropbox.com/scl/fi/1exa5owhx97kozgshjx3d/1.png?rlkey=b5rtxqmcprjgfrqnkspgguwuy&dl=0

https://www.dropbox.com/scl/fi/1exa5owhx97kozgshjx3d/1.png?rlkey=b5rtxqmcprjgfrqnkspgguwuy&dl=1
https://www.dropbox.com/scl/fi/1exa5owhx97kozgshjx3d/1.png?rlkey=b5rtxqmcprjgfrqnkspgguwuy&dl=0&raw=1
https://www.dropbox.com/scl/fi/1exa5owhx97kozgshjx3d/1.png?rlkey=b5rtxqmcprjgfrqnkspgguwuy&dl=1&raw=1

 

So I'd like to ask if I can still download files from a shared link of dropbox to my local backend instance using javascript.

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    Hi again dgtal box,

    Yes, as mentioned in another thread here on the forum where you participate too, there are some issues with CORS. You still can request the pointed file with some tricks, like following:

    As you can see it's possible. Just change the domain as shown and that's it. The missing header, as in your case, here exists! By the way, you can just wipe out the ending "&dl=0", but it's not something mandatory.

    Hope this helps.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,888 PostsLatest Activity: 3 hours ago
326 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!