US 12,341,845 B2
File downloading method and apparatus, storage medium, and electronic device
Weiguang Di, Beijing (CN)
Assigned to BEIJING BYTEDANCE NETWORK TECHNOLOGY CO., LTD., Beijing (CN)
Appl. No. 18/289,359
Filed by Beijing Bytedance Network Technology Co., Ltd., Beijing (CN)
PCT Filed May 26, 2022, PCT No. PCT/CN2022/095210
§ 371(c)(1), (2) Date Nov. 2, 2023,
PCT Pub. No. WO2023/273725, PCT Pub. Date Jan. 5, 2023.
Claims priority of application No. 202110738259.6 (CN), filed on Jun. 30, 2021.
Prior Publication US 2024/0244103 A1, Jul. 18, 2024
Int. Cl. H04L 67/06 (2022.01); G06F 16/17 (2019.01); H04L 67/60 (2022.01)
CPC H04L 67/06 (2013.01) [G06F 16/1724 (2019.01)] 13 Claims
OG exemplary drawing
 
1. A file downloading method, comprising:
switching, in response to an obtained downloading interface switching request in a downloading process of a target file, a first downloading interface for currently downloading the target file to a second downloading interface for continuously downloading the target file, the first downloading interface being a first one of a foreground downloading interface and a background downloading interface, the second downloading interface being a second one of the foreground downloading interface and the background downloading interface;
taking file data downloaded by the first downloading interface this time as a file fragment, and determining index information of the file fragment;
storing the index information in a database;
sequentially reading, based on a storage sequence of index information in the database subsequent to completing a task of downloading the target file, file fragments corresponding to the index information and splicing the file fragments to obtain the target file;
wherein the file data downloaded by the foreground downloading interface is stored in a disk, and the file data downloaded by the background downloading interface is stored in a temporary storage location;
transferring the file data downloaded by the background downloading interface from the temporary storage location into the disk in real time;
wherein switching the first downloading interface for currently downloading the target file to the second downloading interface comprises:
taking a location, in the target file, of file data in the file fragment that has been written and stored to the disk as a breakpoint location; and
continuing to download the target file from the breakpoint location by the second downloading interface; and
wherein determining the index information of the file fragment comprises:
determining the index information based on a disk start offset address and a disk termination offset address, in the disk, of the file data in the file fragment that has been written and stored to the disk.