Giter Site home page Giter Site logo

如何在下载文件前获取文件是否下载过和下载是否完成的状态?还有能否加入同时查询多个url的状态和值?以及能否加入没有文件名称自动获取服务器的文件名? about rxdownload HOT 7 CLOSED

ssseasonnn avatar ssseasonnn commented on May 2, 2024
如何在下载文件前获取文件是否下载过和下载是否完成的状态?还有能否加入同时查询多个url的状态和值?以及能否加入没有文件名称自动获取服务器的文件名?

from rxdownload.

Comments (7)

ssseasonnn avatar ssseasonnn commented on May 2, 2024

用receiveDownloadStatus(),不管是否下载, 都能收到状态。

from rxdownload.

ssseasonnn avatar ssseasonnn commented on May 2, 2024

现在还没有批量添加下载任务和查询多个下载状态的方法, 后续会逐渐完善和增加。
最近工作比较忙,更新比较慢, 请谅解。

from rxdownload.

ssseasonnn avatar ssseasonnn commented on May 2, 2024

自动获取服务器的文件名之前考虑过, 根据响应头的ContentDisposition字段来获取文件名, 但是这样会多增加一次网络请求,权衡了一下觉得并不值得这么做。

from rxdownload.

caixingke avatar caixingke commented on May 2, 2024

判断文件名的操作, 上层自己处理就可以(如果不指定文件名, 则查询ContentDisposition; 如果ContentDisposition也没查到, 则使用url; 如果url不便做为文件名, 则采用其对应的md5, 等等).
我在我司的项目中, 其实也涉及到这个问题. 因为项目工期的问题, 我只是简单的做如上所述的判断.
不过, 当时其实是有过如下的考虑的, 但这个到后面再来补充:
(1)如果有指定文件名, 则直接将url和文件名保存到mDownloadRecord; 如果没有指定文件名, 则只将url保存到mDownloadRecord中.
(2)然后发起一个查询请求(查询是否支持range/是否有指定文件名等). 如果没有指定文件名的话, 则从ContentDisposition来读取文件名等得到一个文件名的操作, 然后填入mDownloadRecord集合中 . 后面再来进行对下载文件是否已存在/是否支持range等的判断之类的操作.
这样做的话, 就不需要再额外增加一个网络请求.

from rxdownload.

ssseasonnn avatar ssseasonnn commented on May 2, 2024

@caixingke 恩,等忙完这段时间,好好重新思考一下。

from rxdownload.

yuanxingxing avatar yuanxingxing commented on May 2, 2024

3q

from rxdownload.

ssseasonnn avatar ssseasonnn commented on May 2, 2024

新版本修复了这几个问题,具体请看文档及代码🙂

from rxdownload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.