DownloadManager downloading files over 2.1 GB

前端 未结 5 2410
青春惊慌失措
青春惊慌失措 2021-02-19 02:53

I am working on an app and one of the features I am working on is to download some binary files. Some of them are really big (more than several mega-bytes). Downloads are comple

5条回答
  •  礼貌的吻别
    2021-02-19 03:48

    To download such a large files, you need to download those in chunks. Either you can use any library that support HTTP range options to allow to pull down a single file in multiple pieces , supporting resume etc.

    Or you can split your large file on your server then have a text file with MD5 hash of each file, when you first start to download then get the MD5 file once finish then check that hashes matches the downloaded pieces. If they do not then delete that piece and add it to queue of items to download.

    Once all pieces downloaded and MD5 works, you can put the pieces back together as single file.

    If you are thinking to download the file in the SD card then FAT32 is the default file system. There is a 4 GB per file limit with this file system.

提交回复
热议问题