dongxu3029 2016-08-11 21:28
浏览 554
已采纳

如何显示进度和下载速度[关闭]

First, thanks to help me! How can i make a file first download to the browser and after that just popup the file... e.g http://mega.nz

I did server side script php, it sends to browser the file in chunks with the content-disposition header and it works!

But i want first download it to browser and show progress & speed.

English isn't my main language...

  • 写回答

2条回答 默认 最新

  • doujing1967 2016-08-11 21:48
    关注

    This is not going to be a complete answer, but I will try and get you started on the right path.

    First off, you'll need to use the a filesystem API to download your file to the browser cache. For chrome you can find more info here: https://developer.chrome.com/apps/fileSystem

    The API extends through HTML5 though, so you can do this in other browsers as well. See this article for more information: http://www.html5rocks.com/en/tutorials/offline/quota-research/#toc-desktop

    Now that is how it works behind the scenes, as far as implementing it yourself, take a look at FileSaver.js
    From their Github:

    FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it. There is a FileSaver.js demo that demonstrates saving various media types.

    FileSaver.js is the solution to saving files on the client-side, and is perfect for webapps that need to generate files, or for saving sensitive information that shouldn't be sent to an external server.

    This should allow you to target any modern browser for large file downloading, as well as pausing and resuming downloads.

    You may also want to look into NodeJS as there will likely be some packages made already you could leverage in your server application.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能