在Chrome浏览器JavaScript API中以块的形式下载文件? [英] Download file in chunks in Chrome Javascript API?
本文介绍了在Chrome浏览器JavaScript API中以块的形式下载文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Chrome浏览器JavaScript API是否支持同时下载几个区块中的文件?例如在一个下载管理器中。
Does the Chrome Javascript API support downloading a file in several chunks simultaneously? eg in a download manager.
推荐答案
简短回答:不,没有特别的支持。有一个专门的 chrome.downloads
API,但它与普通的Chrome下载,即单流相同。
Short answer: no, no special support. There is a dedicated chrome.downloads
API, but it's just the same mechanism as normal Chrome downloads, i.e. single stream.
长答案:您可以通过 XMLHttpRequest
来设置范围属性,例如
Long answer: You can make it yourself via XMLHttpRequest
by setting range attributes, e.g.
xhr.setRequestHeader("Range", "bytes=100-200");
See more information here, and potential problems you can run into in this question.
这篇关于在Chrome浏览器JavaScript API中以块的形式下载文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文