Methods, devices, equipment, and storage media for resuming interrupted downloads of data chunks

By storing data fragments and progress metadata separately on the client side and reverting to the start position of the resume download, the problems of unreliable download status and inaccurate breakpoints are solved, achieving efficient and reliable resume download and ensuring file integrity.

CN123123335APending Publication Date: 2026-11-17SHENZHEN COMTOP INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611474490.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-21
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

When downloading large files in chunks on the client side, existing technologies suffer from unreliable persistence of download status and inaccurate start points for resuming interrupted downloads, leading to file corruption and low download efficiency.

Method used

A separate storage structure is adopted, storing data fragments and progress metadata in independent first and second storage areas respectively. The start position of resume transmission from breakpoint is determined by a preset rollback step size, and the fragment status is checked by timed polling to ensure file integrity and reliability.

Benefits of technology

It significantly reduces the time complexity of progress query, ensures the reliability of breakpoint resume and the integrity of file merging, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123335A_ABST
    Figure CN123123335A_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, device, and storage medium for resuming interrupted downloads of data chunks. The method includes: responding to a download trigger command for a target file, obtaining progress metadata corresponding to the target file from local persistent storage, where the local persistent storage includes independently configured first and second storage areas; determining the starting chunk position for resuming the interrupted download based on the number of processed chunks contained in the progress metadata, the starting chunk position being backslid by a preset step relative to the chunk position corresponding to the number of processed chunks; requesting the remaining data chunks from the server starting from the starting chunk position and storing them in the first storage area, while simultaneously updating the progress metadata in the second storage area. This application achieves efficient recovery of download progress and ensures file integrity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer data transmission technology, and in particular to a method, apparatus, device, and storage medium for resuming interrupted data downloads in data chunks. Background Technology

[0002] In scenarios where large files are downloaded in chunks on the client side, the download progress is typically recorded in memory or simple local storage. However, when the page is refreshed or the application is restarted, the download status in memory is easily lost, requiring the entire data to be downloaded again. Even when using local storage, if chunk data and progress information are stored together, querying the number of downloaded chunks requires traversing a large number of records, which is inefficient.

[0003] Furthermore, when resuming downloads after a network interruption, if the last segment position recorded in the previous record is used as the starting point for resuming the download, dirty data may be generated due to incomplete writing of that segment, which may lead to corruption of the merged file.

[0004] Therefore, there is an urgent need for a solution that can reliably persist the download status in the client environment, efficiently query the progress, and accurately determine the start point of the resume download. Summary of the Invention

[0005] To address the problems of unreliable persistent download status and inaccurate start points for resuming interrupted downloads in existing technologies, this application proposes a data chunked download method for resuming interrupted downloads, thereby achieving efficient recovery of download progress and ensuring file integrity.

[0006] In a first aspect, embodiments of this application provide a method for resuming interrupted downloads of data segments, the method comprising: In response to a download trigger command for a target file, progress metadata corresponding to the target file is obtained from local persistent storage. The local persistent storage includes a first storage area and a second storage area that are configured independently. The first storage area is used to store multiple data fragments of the target file, and the second storage area is used to store the progress metadata. Based on the number of processed fragments contained in the progress metadata, the starting fragment position for resuming interrupted transmission is determined. The starting fragment position is backed up by a preset step size relative to the fragment position corresponding to the number of processed fragments. Starting from the initial fragment position, a request is made to the server to obtain the remaining data fragments of the target file, the obtained remaining data fragments are stored in the first storage area, and the progress metadata in the second storage area is updated.

[0007] Secondly, embodiments of this application provide a data fragment download interruption resumption device, the device comprising: The data acquisition module is used to retrieve the progress metadata corresponding to the target file from the local persistent storage in response to a download trigger command for the target file. The local persistent storage includes an independently configured first storage area and a second storage area. The first storage area is used to store multiple data fragments of the target file, and the second storage area is used to store the progress metadata. The location determination module is used to determine the starting fragment position for breakpoint resumption based on the number of processed fragments contained in the progress metadata. The starting fragment position is backed down by a preset step size relative to the fragment position corresponding to the number of processed fragments. The chunked download module is used to request the remaining data chunks of the target file from the server starting from the initial chunk position, store the obtained remaining data chunks in the first storage area, and update the progress metadata in the second storage area.

[0008] Thirdly, embodiments of this application also provide an electronic device, which includes: One or more processors; Storage device for storing one or more programs. When one or more programs are executed by one or more processors, the one or more processors implement the breakpoint resume method for data chunked download as provided in any embodiment of this application.

[0009] Fourthly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the breakpoint resume method for data segmented download as provided in any embodiment of this application.

[0010] The technical solution of this application embodiment stores the fragment entity data and progress metadata in independent first and second storage areas in local persistent storage, respectively. This allows progress queries to be completed without traversing fragment data, only by reading lightweight metadata, significantly reducing query time complexity. At the same time, when determining the start position of the breakpoint resume transmission, the position corresponding to the number of processed fragments is actively backed by a preset step to ensure that the start point of the resume transmission covers fragments that may not have been completely written in the previous transmission, thereby avoiding file corruption caused by dirty data. Combined with periodic polling to detect the status of all fragments in place before triggering the merging, the race condition under concurrent writing is further eliminated, ensuring the integrity and reliability of file merging. Attached Figure Description

[0011] Figure 1 A flowchart illustrating the breakpoint resumption method for data segmented download provided in Embodiment 1 of this application; Figure 2This is a schematic diagram of a data fragment download interruption resume device provided in Embodiment 5 of this application; Figure 3 This is a schematic diagram of the structure of an electronic device provided in Embodiment Six of this application. Detailed Implementation

[0012] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present application, not the entire structure.

[0013] Example 1 Figure 1 This is a flowchart illustrating the breakpoint resumption method for data fragment downloading provided in Embodiment 1 of this application, as shown below. Figure 1 As shown, the data chunk download breakpoint resumption method provided in this embodiment can be applied to data chunk download breakpoint resumption platforms mounted on devices with data processing capabilities such as computers. It can be used in conjunction with some application software to achieve a better experience, and can specifically include the following steps: Step 101: In response to a download trigger command for a target file, retrieve the progress metadata corresponding to the target file from local persistent storage. The local persistent storage includes a first storage area and a second storage area that are configured independently. The first storage area is used to store multiple data fragments of the target file, and the second storage area is used to store the progress metadata.

[0014] Specifically, when a user initiates a download or re-enters the download page on the client, the system first accesses local persistent storage to restore the historical state. This local persistent storage refers to non-volatile storage space on the client device, which retains data even after the application is closed, the page is refreshed, or the device is restarted.

[0015] The core of this embodiment lies in dividing the storage structure into a logically independent first storage area and a second storage area. The first storage area is specifically used to carry the physical binary data blocks of the target file after it has been split, i.e., data fragments. The amount of data in these fragments is usually large and grows dynamically with the download process. The second storage area is specifically used to record lightweight information describing the download progress, i.e., progress metadata, such as the number of fragments processed, file identifiers, and the total number of fragments.

[0016] The technical mechanism of this split design is to decouple the small amount of metadata read frequently from the large amount of fragmented data read infrequently. This allows the system to determine the current progress by directly reading a small number of records in the second storage area, without scanning or traversing the massive fragmented dataset during initialization or breakpoint resume judgment.

[0017] It should be understood that although this embodiment uses two independent regions as an example for illustration, in other embodiments, as long as the fragmented data and progress metadata are physically or logically isolated and can achieve independent read and write operations without interference, they all fall within the protection scope of this application. Through the above-mentioned separate storage mechanism, the I / O overhead during state recovery is significantly reduced, achieving millisecond-level reading and recovery of download progress.

[0018] Step 102: Based on the number of processed fragments contained in the progress metadata, determine the starting fragment position for resuming interrupted transmission. The starting fragment position is backed up by a preset step size relative to the fragment position corresponding to the number of processed fragments.

[0019] Specifically, after obtaining the progress metadata, the system does not directly use the next position corresponding to the number of processed fragments as the starting point for resuming transmission. Instead, it actively performs a rollback operation. The "rollback preset step size" here is a functional limitation feature, which is essentially a safety redundancy set up to deal with possible abnormal interruptions during network transmission or local writing.

[0020] In real-world download scenarios, when a client records that a certain segment has been completed, the segment data may be in the middle of the write buffer, or although the write is complete, it has not yet passed the integrity check. If a crash or power outage occurs at this time, the segment is actually incomplete or corrupted "dirty data".

[0021] If the record value is directly trusted and the process starts from the next fragment during resuming the transmission, this potentially dirty data will be retained and eventually merged into the complete file, rendering the file unusable. Therefore, this embodiment forces the starting fragment position to move forward by a preset step size, thereby overwriting fragments that may not have been completely written in the previous transmission.

[0022] The specific value of the preset step size can be configured according to the reliability requirements of the business, such as setting it to 1 shard unit, 2 shard units, or other empirical values. This strategy of trading space for time and using a small amount of redundant traffic to ensure absolute data integrity fundamentally eliminates the risk of file corruption in breakpoint resume scenarios and improves the reliability of the user experience.

[0023] Step 103: Starting from the initial fragment position, request the server to obtain the remaining data fragments of the target file, store the obtained remaining data fragments in the first storage area, and update the progress metadata in the second storage area.

[0024] Specifically, after determining the starting fragment position after a safe rollback, the client constructs a network request to pull all subsequent fragment data starting from that position from the server. Upon receiving each data fragment, the system writes it to the corresponding storage location in the first storage area; for fragments re-downloaded due to the rollback, this write operation is a process of overwriting the original location, thereby replacing any potentially existing incomplete data.

[0025] After the sharded data is successfully persisted to the first storage area, the system synchronously updates the progress metadata in the second storage area, such as incrementing the number of processed shards or updating the latest shard index. It is important to emphasize that the metadata update should lag behind the sharded data write operation to ensure transactional consistency between the two and prevent a false progress state where "metadata has been updated but shards have not been written".

[0026] This atomic cycle of "download-store-update" ensures that the state recorded in the local persistent storage always accurately reflects the actual completion status of the file, providing a reliable basis for resuming the download from a possible point of failure.

[0027] Example 2 Based on the breakpoint resume method for data segmented download provided in Embodiment 1, as an optional implementation, the first storage area and the second storage area are independent first data tables and second data tables in local persistent storage.

[0028] Specifically, this logical division of regions is physically mapped to two independent data objects or tables. The first data table is dedicated to carrying fragmented entity data of binary large object type, and each record is associated with a unique fragment index to identify the sequential position of the fragment in the complete target file; the second data table focuses on storing lightweight progress metadata, which includes at least the total number of fragments processed, and the system uses this total number of fragments processed to determine the current number of fragments processed.

[0029] By completely decoupling the massive sharded stream data from the minute state control data at the table structure level, high-frequency read and write operations on progress completely avoid I / O interference from the sharded data table. Even in extreme scenarios where the number of shards reaches thousands or even tens of thousands, the update and read of progress status can still maintain constant and extremely low latency.

[0030] Furthermore, as a preferred implementation, local persistent storage is provided by an IndexedDB database. In this implementation, the primary key of the first data table is generated by combining the target file's identification information with the shard index, to support the location of data shards based on the identification information and the shard index; the primary key of the second data table is the target file's identification information, to support the querying of progress metadata based on the identification information.

[0031] Specifically, IndexedDB, as a browser-based non-volatile NoSQL database, naturally supports large-capacity structured storage and asynchronous transaction processing, making it ideal for scenarios involving downloading large files in chunks. In the first data table, the primary key uses a combination of "attachment ID_chunk number". For example, for a target file with the identifier "att_123", the primary key of its 5th chunk is "att_123_5".

[0032] This composite primary key design leverages the underlying B+ tree index characteristics of the database, enabling the system to directly calculate the storage address by concatenating strings. This allows for O(1) level precise location and writing to any specified fragment without any range scans. Correspondingly, the second data table uses only the target file's identifier information as a single primary key. This means that regardless of how many fragments the download task contains, obtaining the current download progress always requires only a single direct lookup operation based on the primary key.

[0033] To more clearly illustrate the technical advantages of this embodiment, a comparative analysis is conducted below with the traditional single-table hybrid storage architecture. In traditional technical solutions, sharded data and progress information are often stored in the same data table, or progress information needs to be obtained by traversing the sharded table and counting the number of records.

[0034] When the file size is large and the number of fragments is large, each time the download or update progress is restored, a full scan or aggregation calculation of the entire table is required. Its time complexity increases linearly with the number of fragments, i.e., O(N). This can lead to obvious interface lag and state restoration delay in weak network environments or low-end devices.

[0035] This embodiment reduces the time complexity of progress queries from O(N) to O(1) by using a dual-table separation and a specific primary key combination strategy, and also stabilizes the writing and retrieval of sharded data at the O(1) level. This performance improvement is not a simple numerical optimization, but stems from a fundamental restructuring of the storage architecture, which fundamentally eliminates the negative impact of data expansion on state management efficiency and ensures the instantaneous response capability of the breakpoint resume function under various file sizes and network conditions. It should be understood that although this embodiment uses IndexedDB as an example for detailed explanation, the same technical effect can be achieved in other local persistent media with similar key-value storage capabilities as long as the above dual-table separation and corresponding primary key index strategy are adopted.

[0036] Example 3 As an optional implementation, the starting fragment position for resuming interrupted downloads is determined based on the number of processed fragments contained in the progress metadata. Specifically, this includes determining the fragment position preceding the fragment position corresponding to the number of processed fragments as the starting fragment position, so that the data fragment corresponding to the preceding fragment position can be re-acquired and overwritten during resumed download.

[0037] Specifically, the "preset backoff step size" mentioned in Example 1 is specified in this example as backoff by one shard unit. This design is not an arbitrary numerical choice, but is based on a deep consideration of the uncertainty of data state under abnormal client interruption scenarios.

[0038] During the actual download process, after the system records that a certain segment has been completed and updates the progress metadata, the segment data may be in the refresh stage of the write buffer at the physical storage level, or although it has been written to disk, there is a risk of bit flipping due to the lack of application layer verification.

[0039] If the resumed download directly trusts the recorded progress value and starts requesting from the next fragment, this potentially "dirty" fragment will be retained and eventually participate in the file merging, resulting in a corrupted complete file. Therefore, this embodiment constructs a logically safe redundancy zone by actively rolling back to the previous fragment from the starting position, forcibly triggering the re-downloading and overwriting of the data at that position.

[0040] It should be understood that although this embodiment uses a rollback of one fragment position as a preferred example, in specific business scenarios where the network environment is extremely unstable or the data integrity requirements are extremely high, the rollback step size can also be configured to two or more fragment positions, and can even be dynamically adjusted according to the historical network packet loss rate. As long as the core logic of "rollback and overwrite" to eliminate dirty data at the end is met, it falls within the protection scope of this application.

[0041] Furthermore, as a specific implementation scheme, the starting fragment position is calculated using the following formula: fileStartReadCount = count - 1.

[0042] Where fileStartReadCount represents the fragment sequence number corresponding to the starting fragment position, and count represents the number of fragments that have been processed. In this formula, count is a value directly read from the progress metadata of the second storage area, representing the total number of fragments that the system believes have been successfully processed at the end of the last download session; fileStartReadCount is the actual starting index when the current resume download task sends a request to the server.

[0043] For example, if the progress metadata record count is 47, it means that the system considers the first 47 shards (index 0 to 46) to be completed. According to the formula, fileStartReadCount is calculated to be 46, which means that this resume download will start from the shard with index 46, instead of starting from index 47.

[0044] It is particularly important to emphasize that when requesting the remaining data fragments from the server starting from the initial fragment position, the data fragments corresponding to the previous fragment position must be overwritten and written to the corresponding storage location in the first storage area.

[0045] The "overwrite" here is a crucial action closely integrated with the above formula. Its technical essence is to unconditionally replace any old data that may exist in the local storage location with authoritative and complete data returned by the server. This is fundamentally different from the "append write" or "skip existing fragments" strategies commonly found in traditional download tools.

[0046] If the rollback position is calculated using a formula, but the write operation is skipped when data is detected already at that position during storage, then the rollback operation loses its practical meaning, and the dirty data will still be retained. Only by combining the positioning logic of "count-1" with the execution logic of "overwrite" can a complete technical loop be formed, fundamentally ensuring the binary integrity of the file after a breakpoint resumes.

[0047] This mechanism ensures that even if the previous download was interrupted when the 46th segment was halfway through writing, the current resumed download will re-download the complete 46th segment and overwrite the incomplete half-finished product, thus ensuring that the final merged target file is completely consistent with the source file, significantly improving the reliability of large file transfers and user experience.

[0048] Example 4 As an optional implementation, the method further includes: detecting whether the last data fragment and all data fragments of the target file have been stored in the first storage area through a timed polling mechanism; when it is detected that all data fragments have been stored in the first storage area, triggering a fragment merging process to merge multiple data fragments in the first storage area into a complete target file.

[0049] Specifically, due to the asynchronous nature of network requests and the uncertain time consumption of local persistent storage write operations, there is often a time difference between the completion of disk write of fragmented data and the return of the network response. If the overall download is judged to be complete only by the callback event of a single fragment download completion, it is easy to misjudge due to race conditions caused by concurrent writes. For example, the merge may be triggered prematurely when the network response of the last fragment arrives but has not yet been fully written to the database, resulting in the generated file missing the tail data.

[0050] Therefore, this embodiment introduces a timed polling mechanism independent of the download thread as a security gatekeeper. This mechanism includes two layers of verification logic: first, it checks whether the last data fragment exists as a quick filtering condition; then, it further verifies the integrity of all data fragments, for example, by comparing whether the number of fragments actually recorded in the first storage area is consistent with the total number of fragments recorded in the progress metadata, or by traversing and checking for the existence of gapped indexes.

[0051] Only when both checks pass is the download phase truly complete and the merging process triggered. This design decouples "state detection" and "file merging" into two independent sequential actions, effectively avoiding the risk of state inconsistency caused by asynchronous I / O and ensuring the atomicity and reliability of the merging operation.

[0052] Furthermore, as a preferred implementation, the polling interval for the timed polling mechanism is 500 milliseconds. This parameter is chosen based on a balance between client performance and user experience. If the polling interval is too short (e.g., less than 100ms), frequent database queries will consume excessive main thread resources or I / O bandwidth, potentially causing page rendering stutters or affecting the speed of ongoing chunk downloads. If the polling interval is too long (e.g., greater than 2 seconds), it will introduce a significant waiting delay after the download is complete, lengthening the perceived gap between "download complete" and "file pop-up," thus reducing the smoothness of the experience. The 500-millisecond interval ensures that status confirmation is completed within a time window imperceptible to the human eye while keeping system overhead at an extremely low level.

[0053] It should be understood that although this embodiment uses 500 milliseconds as an example, in actual applications, this interval can also be dynamically adjusted according to the device performance level or file size. For example, it can be shortened to 200 milliseconds on high-performance devices to improve response speed, or extended to 1 second on low-end devices to ensure stability. As long as the periodic integrity verification function can be achieved, it falls within the protection scope of this application.

[0054] In addition, to ensure the sustainable use of client resources, the method also includes: after the target files are merged and the download is triggered, deleting all data fragments of the target files stored in the first storage area and deleting the progress metadata of the target files stored in the second storage area, so as to release the storage space of the local persistent storage.

[0055] Specifically, after the fragmented data is merged to generate a complete file and handed over to the browser or system download manager, the fragmented data in the first storage area and the temporary progress records in the second storage area lose their value.

[0056] Without this cleanup step, as users download different files multiple times, the local persistent storage will be filled with a large amount of useless intermediate data. This will not only consume valuable storage resources on the user's device but may also cause logical confusion in subsequent download tasks of files with the same name due to reading old residual metadata. Therefore, this embodiment regards the cleanup operation as a necessary termination step in the download lifecycle and strictly limits its execution time to "after merging is completed and download is triggered".

[0057] This timing constraint is crucial, preventing accidental deletion of source data during the merging process from causing merge failure, and also avoiding the risk of deleting data after a successful merge but before successfully initiating the download, thus preventing users from accessing the files. This "use-and-discard" resource management strategy achieves zero intrusion and zero burden on the client environment for the breakpoint resume function, ensuring the robustness of the technical solution in long-term operational scenarios.

[0058] Example 5 Figure 2 This is a schematic diagram of a data chunk download breakpoint resumption device provided in Embodiment 5 of this application. The data chunk download breakpoint resumption device provided in this embodiment can execute the data chunk download breakpoint resumption method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects of the execution method. This device can be implemented in software and / or hardware, such as... Figure 3 As shown, the data chunk download breakpoint resume device specifically includes: The data acquisition module 201 is used to retrieve the progress metadata corresponding to the target file from the local persistent storage in response to a download trigger command for the target file. The local persistent storage includes an independently configured first storage area and a second storage area. The first storage area is used to store multiple data fragments of the target file, and the second storage area is used to store the progress metadata. The location determination module 202 is used to determine the starting fragment position for breakpoint resumption based on the number of processed fragments contained in the progress metadata. The starting fragment position is backed up by a preset step size relative to the fragment position corresponding to the number of processed fragments. The chunk download module 203 is used to request the remaining data chunks of the target file from the server starting from the starting chunk position, store the obtained remaining data chunks in the first storage area, and update the progress metadata in the second storage area.

[0059] Example 6 Figure 3 This is a schematic diagram of the structure of an electronic device provided in Embodiment Six of this application, as shown below. Figure 3 As shown, the electronic device includes a processor 310, a memory 320, an input device 330, and an output device 340; the number of processors 310 in the electronic device can be one or more. Figure 3 Taking a processor 310 as an example; the processor 310, memory 320, input device 330, and output device 340 in the electronic device can be connected via a bus or other means. Figure 3 Taking the example of a connection between China and Israel via a bus.

[0060] The memory 320, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the breakpoint resumption method for data chunked download in this embodiment of the invention. The processor 310 executes various functional applications and data processing of the electronic device by running the software programs, instructions, and modules stored in the memory 320, thereby implementing the breakpoint resumption method for data chunked download described above. In response to a download trigger command for a target file, progress metadata corresponding to the target file is obtained from local persistent storage. The local persistent storage includes a first storage area and a second storage area that are configured independently. The first storage area is used to store multiple data fragments of the target file, and the second storage area is used to store the progress metadata. Based on the number of processed fragments contained in the progress metadata, the starting fragment position for resuming interrupted transmission is determined. The starting fragment position is backed up by a preset step size relative to the fragment position corresponding to the number of processed fragments. Starting from the initial fragment position, a request is made to the server to obtain the remaining data fragments of the target file, the obtained remaining data fragments are stored in the first storage area, and the progress metadata in the second storage area is updated.

[0061] The memory 320 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function; the data storage area may store data created based on terminal usage. Furthermore, the memory 320 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 320 may further include memory remotely located relative to the processor 310, which can be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0062] Example 7 This embodiment provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the breakpoint resumption method for data fragmented download as described below: In response to a download trigger command for a target file, progress metadata corresponding to the target file is obtained from local persistent storage. The local persistent storage includes a first storage area and a second storage area that are configured independently. The first storage area is used to store multiple data fragments of the target file, and the second storage area is used to store the progress metadata. Based on the number of processed fragments contained in the progress metadata, the starting fragment position for resuming interrupted transmission is determined. The starting fragment position is backed up by a preset step size relative to the fragment position corresponding to the number of processed fragments. Starting from the initial fragment position, a request is made to the server to obtain the remaining data fragments of the target file, the obtained remaining data fragments are stored in the first storage area, and the progress metadata in the second storage area is updated.

[0063] It is worth noting that in the embodiments of the above-mentioned device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of this application.

[0064] Note that the above description is merely a preferred embodiment and the technical principles employed in this application. Those skilled in the art will understand that this application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments. Many other equivalent embodiments may be included without departing from the concept of this application, and the scope of this application is determined by the scope of the appended claims.

Claims

1. A method for resuming interrupted downloads of data chunks, characterized in that, The method includes: In response to a download trigger command for a target file, progress metadata corresponding to the target file is obtained from local persistent storage. The local persistent storage includes a first storage area and a second storage area that are configured independently. The first storage area is used to store multiple data fragments of the target file, and the second storage area is used to store the progress metadata. Based on the number of processed fragments contained in the progress metadata, the starting fragment position for resuming interrupted transmission is determined. The starting fragment position is backed up by a preset step size relative to the fragment position corresponding to the number of processed fragments. Starting from the initial fragment position, a request is made to the server to obtain the remaining data fragments of the target file, the obtained remaining data fragments are stored in the first storage area, and the progress metadata in the second storage area is updated.

2. The method according to claim 1, characterized in that, The first storage area and the second storage area are independent first and second data tables in the local persistent storage; Each data shard stored in the first data table is associated with a shard index, and the progress metadata stored in the second data table contains the total number of shards processed. The number of shards processed is determined based on the total number of shards processed.

3. The method according to claim 2, characterized in that, The local persistent storage is an IndexedDB database; The primary key of the first data table is generated by combining the identification information of the target file with the shard index, so as to support the location of the data shard based on the identification information and the shard index; The primary key of the second data table is the identification information of the target file, so as to support querying the progress metadata based on the identification information.

4. The method according to claim 1, characterized in that, Based on the number of processed fragments contained in the progress metadata, the starting fragment position for resuming interrupted downloads is determined, including: The position of the previous fragment corresponding to the number of processed fragments is determined as the starting fragment position, so that the data fragment corresponding to the previous fragment position can be re-acquired and overwritten when the download resumes.

5. The method according to claim 4, characterized in that, The starting fragment position is calculated using the following formula: fileStartReadCount = count - 1; Wherein, fileStartReadCount represents the fragment number corresponding to the starting fragment position, and count represents the number of fragments that have been processed; When requesting the remaining data fragments from the server starting from the initial fragment position, the data fragments corresponding to the previous fragment position are overwritten and written to the corresponding storage location in the first storage area.

6. The method according to claim 1, characterized in that, The method further includes: The last data fragment and all data fragments of the target file are detected by a timed polling mechanism to see if they have been stored in the first storage area. When it is detected that all the data fragments have been stored in the first storage area, a fragment merging process is triggered to merge the multiple data fragments in the first storage area into the complete target file.

7. The method according to claim 6, characterized in that, The polling interval of the timed polling mechanism is 500 milliseconds; The method further includes: After the target file merging is completed and the download is triggered, all data fragments of the target file stored in the first storage area are deleted, and the progress metadata of the target file stored in the second storage area is deleted, so as to release the storage space of the local persistent storage.

8. A device for resuming interrupted downloads of data chunks, characterized in that, include: The data acquisition module is used to retrieve the progress metadata corresponding to the target file from the local persistent storage in response to a download trigger command for the target file. The local persistent storage includes an independently configured first storage area and a second storage area. The first storage area is used to store multiple data fragments of the target file, and the second storage area is used to store the progress metadata. The location determination module is used to determine the starting fragment position for breakpoint resumption based on the number of processed fragments contained in the progress metadata. The starting fragment position is backed down by a preset step size relative to the fragment position corresponding to the number of processed fragments. The chunked download module is used to request the remaining data chunks of the target file from the server starting from the initial chunk position, store the obtained remaining data chunks in the first storage area, and update the progress metadata in the second storage area.

9. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the breakpoint resumption method for data chunked download as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the breakpoint resumption method for data segmented download as described in any one of claims 1 to 7.