Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

bambaba12's avatar
bambaba12
Explorer | Level 4
2 years ago
Solved

ECONNRESET while downloading shared file as a stream

Hello, when I try to download a shared file using API , the socket closes at the 10th minute, and I receive an 'ECONNRESET' error. Without using the API, I was able to download for an hour. And after an hours it's closing the connection again. By the way, the file I'm downloading is over 100GB. Can you help me with this issue?

await this.httpService.axiosRef({
url: 'https://content.dropboxapi.com/2/sharing/get_shared_link_file',
method: 'POST',
headers: {
Authorization: `Bearer ${DROPBOX_API_TOKEN}`,
'Dropbox-API-Arg': JSON.stringify({ url: videoUrl }),
'Content-Type': 'application/octet-stream',
},
responseType: 'stream',
});
  • We've increased the /2/sharing/get_shared_link_file endpoint timeout. For downloads that will take a long time, please use Range requests to retrieve the entire file across multiple requests as described in my previous message.

3 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    Thanks for the report! It looks like the /2/sharing/get_shared_link_file endpoint is configured with a 10 minute timeout. I'll ask the team to look into whether we can increase that.

     

    As a workaround, whether you're using this /2/sharing/get_shared_link_file endpoint or are downloading from the shared link directly, you can use "Range" requests to download a portion of the file at a time.

     

    So if you need to perform these downloads over periods of time longer than the relevant timeout, please use multiple requests lasting no longer than the timeout, to download a piece of the file per request, and then re-assemble the file.

     

    For example, here's a sample of what it would look like in curl:

    curl -v -X POST https://content.dropboxapi.com/2/sharing/get_shared_link_file \
      --header 'Authorization: Bearer ACCESS_TOKEN' \
      --header 'Dropbox-API-Arg: {"url":"SHARED_LINK"}' \
      --header 'Range: bytes=0-10'

    That would download just the first 11 bytes of the file at the shared link. You can modify the byte range to download any piece of a file, such as to continue downloading the next portion of a file.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    We've increased the /2/sharing/get_shared_link_file endpoint timeout. For downloads that will take a long time, please use Range requests to retrieve the entire file across multiple requests as described in my previous message.

  • bambaba12's avatar
    bambaba12
    Explorer | Level 4
    2 years ago

    Thank you. Yes, as you suggested, I started using range, and this has been more effective

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from 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!