0

I am at work and have a need to download large files, 4gb+. I only actually need the first 20mb of these files, however. To conserve bandwidth and time, I would like to only download the first 20mb instead of the whole file. Because I am at work and using Windows 7, I cannot install new software or compile anything. I saw, in the link below, that someone attempts to do this using Java. Because I have access to a web browser, I am able to make applications with Javascript. Is there a way to accomplish downloading only part of a file using only Javascript?

How do I download part of a file using Java?

Community
  • 1
  • 1
Reed B
  • 636
  • 1
  • 8
  • 19

1 Answers1

1

You can send a HTTP RANGE request. This has little to do with JavaScript apart from the fact that you may send the request via AJAX

Community
  • 1
  • 1
marekful
  • 14,986
  • 6
  • 37
  • 59
  • hmm... This may not be the right route. Can you think of any other solution to my problem? – Reed B Jun 12 '13 at 15:56
  • Well, "to download only part of a file", this is your best if not only chance. This may be tricky to achieve and requires correct server-side configuration/code to handle partial download properly. – marekful Jun 12 '13 at 15:59
  • Another way I can think of is if you handle it on server side entirely w/o RANGE request. What I mean is that you could send a request with parameters and those params would tell the server which part of what file you expect in response. Then server-side code can find the file, extract the desired part and send it back to the browser. – marekful Jun 12 '13 at 16:00
  • I don't have access to the server and it doesn't support range requests. :( – Reed B Jun 12 '13 at 16:51