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
8 months agoExplorer | Level 3
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.
- Здравко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.
- dgtal boxExplorer | Level 3
Hi Здравко Thank you!
https://www.dropbox.com/scl/fi/1exa5owhx97kozgshjx3d/1.png?rlkey=b5rtxqmcprjgfrqnkspgguwuy&dl=0
Instead of the above url, I tried with the bellow url.https://dl.dropboxusercontent.com/scl/fi/1exa5owhx97kozgshjx3d/1.png?rlkey=b5rtxqmcprjgfrqnkspgguwuy&
Eventually, it worked.
Any solution for a folder?- ЗдравкоLegendary | Level 20
dgtal box wrote:...
Any solution for a folder?No, that trick doesn't work for folder links, unfortunately. Even if that works, you would need to unzip the content (a zip file would come up, not something else). You could walk through the particular folder tree and download all files while recreating the tree locally instead (like unzipping would do). 😉 Take a look here (shell example) for a possible solution (in your case would be much smaller - javascript has more tools). Just get the idea out of there. You may have some challenges with placing on/accessing local space out of the browser though.
Good luck.
Add: For one more solution targeting listing the pointed folder take a look here (it's in Python - just get idea out from there). 🙂 In such a case you don't need any application registration.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,888 PostsLatest Activity: 3 hours agoIf 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!