Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
amei
4 months agoExplorer | Level 3
Using javascript to download file from dropbox
I am creating a javascript routine that requires me to download and upload updated files in my dropbox app file folders which contains updated football picks. I am able to upload files to my app but when I try to upload I get an undefined error.
file path :
download functions (I tried both of these) :
Both of these functions return the same error :
Any assistance would be greatly appreciated. Thanks.
14 Replies
- amei3 months agoExplorer | Level 3
Hi INeil. As I mentioned previously I was able to download the dropbox jason file and parse it into and array inside the async function shown below. However when I try to use it outside the async function it is either returned as undefined or a promise. Below are more detials.
Load file from dropbox and parse the array. Works fine within this async function.
Results : within function (listed as local) the array works fine, outside function (listed as global), a promise is returned and the array is undefined. Any assistance with using this array outside of the async function would be greatly appreciated.
- James_David3 months agoExplorer | Level 3
The Dropbox Python SDK can fail to download complete files in Pyodide or xlwings lite. A workaround is to call the Dropbox API for a temporary link and then fetch that link with pyfetch. For example, use files/get_temporary_link to get the URL, then call pyfetch(link, method="GET") and use res.bytes() to get the full file. Uploads with the SDK usually work fine, but for downloads this direct fetch method avoids incomplete files.
- amei2 months agoExplorer | Level 3
One more issue I am trying to resolve. As I mentioned previously I was able to download the file from dropbox and properly parse it into an array and access array elements within the async function I use to download the dropbox file. However I am having issues using the array outside of the async function LoadFileFromDropBox. It looks like it returns a promise not an array I can use outside the function. I have tried a few things get the array from the returned promise but unsuccessful. Here is the functions I am trying to work with :
I have tried various calls to try to access the array outside the async function :
The usual results I get on the console is as follows :
Any assistance to be able to use the users_array outside of the async functions would be greatly appreciated. Thanks.
- DB-Des2 months ago
Dropbox Community Moderator
Could you provide the whole code snippet so we can test it on our end?
About Discuss Dropbox Developer & API
Make connections with other developers
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!