A file processing method, a file processing device and a terminal device
By adjusting the size of the file storage area and generating differential files, the problem of low information processing efficiency during the file update process is solved, and efficient file transmission and update are achieved.
Patent Information
- Application Number
- CN201980099830.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-18
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2039-11-18
AI Technical Summary
During the file update process, it is difficult for the existing technology to efficiently process and transmit new version files, resulting in low information processing efficiency.
By obtaining the file collection, adjusting the storage area size to meet the preset conditions, splicing files, calculating differential files and digital signatures, generating target compressed files, and transmitting them to the terminal device to achieve file updates.
It improves the information processing efficiency during the file update process, reduces the transmission traffic consumption, and ensures the continuity and efficiency of file block reading.
Smart Images

Figure CN114303131B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of information processing technology, and in particular, relates to a file processing method, a file processing device, a terminal device, and a computer-readable storage medium. Background Art
[0002] Currently, due to the fast update speed of information, many files often need to be updated. For example, an application installed in a designated terminal often needs to download a new version of the installation package for upgrading, or a certain file needs to be updated, etc. Therefore, the designated terminal often needs to obtain a new version of the file for updating. Summary of the invention
[0003] The present application provides a file processing method, a file processing apparatus, a terminal device and a computer-readable storage medium, which can improve information processing efficiency when reading an acquired new version of a file at a designated terminal for subsequent updating.
[0004] The first aspect of the present application provides a file processing method, comprising:
[0005] Acquire a first file set, where the first file set includes at least one first file;
[0006] Determine the size of the storage area corresponding to each first file;
[0007] If the size of at least one storage area does not meet the preset condition, the storage area that does not meet the preset condition is expanded so that the size of the expanded storage area meets the preset condition, wherein the preset condition refers to that the size of the storage area is a positive integer multiple of a preset threshold;
[0008] After expanding the storage area that does not meet the preset conditions, the first files in the obtained first file set are spliced to obtain a target file set;
[0009] Acquire a second file set, where the second file set is a historical version file set of the first file set;
[0010] Obtaining a first digital signature of the target file set;
[0011] Obtaining a differential file, wherein the differential file includes a first differential result obtained by performing a differential operation on the target file set and the second file set;
[0012] Obtaining a target compressed file including the differential file and the first digital signature;
[0013] The target compressed file is sent to a designated terminal to instruct the designated terminal to obtain a restored target file set according to the target compressed file and a third file set in the designated terminal, wherein the third file set is the same as the second file set.
[0014] A second aspect of the present application provides a file processing device, comprising:
[0015] A first acquisition module, used to acquire a first file set, wherein the first file set includes at least one first file;
[0016] A first determination module, used to determine the size of the storage area corresponding to each first file;
[0017] an adjustment module, configured to, if the size of at least one storage area does not meet a preset condition, expand the storage area that does not meet the preset condition, so that the size of the expanded storage area meets the preset condition, wherein the preset condition refers to that the size of the storage area is a positive integer multiple of a preset threshold;
[0018] A first processing module, configured to splice the first files in the first file set obtained after expanding the storage area that does not meet the preset condition, to obtain a target file set;
[0019] A second acquisition module, used to acquire a second file set, where the second file set is a historical version file set of the first file set;
[0020] A third acquisition module, used to obtain a first digital signature of the target file set;
[0021] A second processing module, configured to obtain a differential file, wherein the differential file includes a first differential result obtained by performing a differential operation on the target file set and the second file set;
[0022] A third processing module, used for obtaining a target compressed file including the differential file and the first digital signature;
[0023] The sending module is used to send the target compressed file to a designated terminal, so that the designated terminal can obtain a restored target file set according to the target compressed file and a third file set in the designated terminal, wherein the third file set is the same as the second file set.
[0024] The third aspect of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the file processing method of the first aspect are implemented.
[0025] The fourth aspect of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the file processing method of the first aspect are implemented.
[0026] A fifth aspect of the present application provides a computer program product, which includes a computer program. When the computer program is executed by one or more processors, the steps of the file processing method of the first aspect are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0028] Figure 1 This is a schematic diagram of an implementation flow of the file processing method provided in an embodiment of the present application;
[0029] Figure 2 It is a schematic diagram of the storage structure of the first file set and the target file set in the file processing method provided in an embodiment of the present application;
[0030] Figure 3 is a structural block diagram of a file processing device provided in an embodiment of the present application;
[0031] Figure 4 It is a schematic diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0033] In order to illustrate the above technical solution of the present application, a specific embodiment is provided below for illustration.
[0034] Example 1
[0035] The following describes a file processing method provided in an embodiment of the present application.
[0036] like Figure 1 FIG. 1 is a schematic diagram of an implementation flow of a file processing method provided in an embodiment of the present application. The file processing method can be applied to a terminal device.
[0037] There are many types of terminal devices to which the embodiments of the present application can be applied. For example, the terminal device may be a server, a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiments of the present application do not impose any restrictions on the specific types of terminal devices.
[0038] In some scenarios, files in some terminals often need to be updated. For example, applications installed in mobile terminals often need to download new versions of installation packages for upgrading, or a certain file needs to be updated, etc. In some cases, when an application in a mobile terminal needs to be upgraded, the user will obtain the new version of the installation package of the application through the browser, application store, etc. in the mobile terminal. In addition, for other files to be updated, it is also necessary to obtain new versions of the files for subsequent updates and other operations. On this basis, in order to improve the convenience of transmission, the new version of the file is often obtained in the form of a compressed package, and a file processing method provided in an embodiment of the present application can read the obtained new version of the file at a specified terminal to improve information processing efficiency during subsequent updates.
[0039] See also Figure 1 , the file processing method in the embodiment of the present application includes:
[0040] In step 101, a first file set is obtained, wherein the first file set includes at least one first file.
[0041] In the embodiment of the present application, the first file set may have multiple file types, for example, the first file set may be a folder, or a compressed file, etc. Each first file in the first file set may be independent or merged together. The first file may also have multiple types, and the types of each first file may be different or the same.
[0042] There may be multiple ways to obtain the first file set, wherein the first file set may be pre-stored in a terminal device executing the embodiment of the present application, or may be obtained by the terminal device from other terminals through a specific information transmission method.
[0043] In step 102, the sizes of the storage areas corresponding to the first files are determined.
[0044] In step 103, if there is at least one storage area whose size does not meet the preset condition, the storage area that does not meet the preset condition is expanded so that the size of the expanded storage area meets the preset condition, wherein the preset condition refers to that the size of the storage area is a positive integer multiple of a preset threshold.
[0045] In the embodiment of the present application, the size of the preset threshold can be determined according to the actual application scenario. In some embodiments, the size of the preset threshold can be determined according to the size of the cache area when the restored target file set is decompressed in the designated terminal later.
[0046] In some cases, the storage area that does not meet the preset conditions is expanded so that the size of the expanded storage area meets the preset conditions, and the difference between the size of the expanded storage area and the size of the storage area before the expansion is less than the preset threshold, so that when the size of the expanded storage area meets the preset conditions, the size of the expanded storage area is as small as possible to reduce the waste of storage resources. In the expanded storage area, the content of the newly added part can be empty.
[0047] It should be noted that, in the embodiment of the present application, the ratio of each storage area that meets the preset condition to the preset threshold is a positive integer, but the ratio of each storage area that meets the preset condition to the preset threshold is not necessarily the same.
[0048] For example, the preset threshold may be 8k, the size of the storage area of the first file 1 is 16k, the size of the storage area of the first file 2 is 32k, and the size of the storage area of the first file 3 is 34k. Then the sizes of the storage areas corresponding to the first file 1 and the first file 2 both meet the preset conditions, while the size of the storage area corresponding to the first file 3 does not meet the preset conditions. At this time, the storage area corresponding to the first file 3 may be expanded to 40k. At this time, the size of the storage area of the first file 1, the size of the storage area of the first file 2, and the size of the storage area corresponding to the expanded first file 3 all meet the preset conditions.
[0049] In step 104, after the storage area that does not meet the preset condition is expanded, each first file in the first file set obtained is spliced to obtain a target file set.
[0050] In the embodiment of the present application, the target file set includes a first file whose corresponding storage area size meets a preset condition and a first file whose corresponding storage area is expanded. Furthermore, the position sequence of each first file in the target file set can be the same as the position sequence of each first file in the first file set. The target file set has the same file type as the first file set.
[0051] The storage structure of the first file set and the target file set is illustrated below by taking a specific example.
[0052] like Figure 2 . It is a schematic diagram of the storage structure of the first file set and the target file set in an embodiment.
[0053] Among them, the file types of the first file set and the target file set are compressed files, the preset threshold can be 8k, the size of the storage area of the first file 1-1 is 16k, the size of the storage area of the first file 2-1 is 32k, the size of the storage area of the first file 3-1 is 34k, and the size of the storage area of the first file 4-1 is 15k. Then in the obtained target file set, the size of the storage area of the first file 1-2 is 16k, the size of the storage area of the first file 2-2 is 32k, the size of the storage area of the first file 3-2 is 40k, and the size of the storage area of the first file 4-2 is 16k. Among them, the first file 3-2 in the target file set is obtained by expanding the first file 3-1 in the first file set, and the first file 4-2 in the target file set is obtained by expanding the first file 4-1 in the first file set.
[0054] In step 105, a second file set is obtained, where the second file set is a historical version file set of the first file set.
[0055] In the embodiment of the present application, the second file set can be determined as a historical version file set of the first file set by information such as version number, file name, etc. There are many ways to obtain the second file set, for example, the terminal device executing the embodiment of the present application can obtain it from other terminals through a specific information transmission method, or it can be pre-stored in the terminal device.
[0056] In some embodiments, the file types of the first file set and the second file set are both compressed files.
[0057] Exemplarily, the first file set may be, for example, a new version installation package, a compressed package obtained by compressing the new version files, etc. The second file set may be a corresponding old version installation package, a compressed package obtained by compressing the old version files, etc. In this case, the target compressed file obtained subsequently may directly include the difference information between the new version installation package and the old version installation package, so that the restored new version installation package can be directly obtained and verified in the designated terminal according to the target compressed file and the third file set. In this case, the steps of information processing are fewer and the information processing speed is higher.
[0058] In step 106, a first digital signature of the target file set is obtained.
[0059] In an embodiment of the present application, the first digital signature can be used to verify the restored target file set in subsequent information processing. Since the target file set is different from the first file set, even if the first file set has a corresponding digital signature, the digital signature of the first file set cannot be used to verify the target file set. Therefore, illustratively, the target file set can be transmitted to the provider of the first file set, and the provider's first digital signature for the target file set can be obtained; or, the first digital signature of the target file set can be generated according to the private key provided by the provider of the first file set (such as a developer).
[0060] In step 107, a differential file is obtained, wherein the differential file includes a first differential result obtained by performing a differential operation on the target file set and the second file set.
[0061] In an embodiment of the present application, the first differential result is obtained by performing a differential operation on the target file set and the first file set, wherein there may be multiple specific differential algorithms, for example, the differential algorithm may be one or more differential algorithms such as Bsdiff, Xdelta3, etc., and the differential algorithm is not limited here.
[0062] In some embodiments, the differential file may also include other differential results.
[0063] Optionally, obtaining the differential file includes:
[0064] Obtaining a second digital signature corresponding to the first file set;
[0065] Performing a differential operation on the target file set and the second file set to obtain a first differential result;
[0066] Performing a differential operation on the first digital signature and the second digital signature to obtain a second differential result;
[0067] The first difference result and the second difference result are combined to obtain the difference file.
[0068] The second digital signature corresponding to the first file set may be a digital signature obtained from the first file set itself; or, if the first file set is obtained by decompressing the first compressed file, the second digital signature corresponding to the first file set may be a digital signature obtained from the first compressed file. In this case, the first digital signature and the second digital signature are differentially calculated to obtain a second differential result, which can reduce the size of the file for subsequent information transmission, thereby reducing the corresponding traffic consumption.
[0069] In step 108, a target compressed file including the differential file and the first digital signature is obtained.
[0070] In the embodiment of the present application, in the target compressed file, the differential file and the first digital signature may exist in multiple forms. Exemplarily, a digital signature file including the first digital signature may be generated, and then the differential file and the digital signature file may be compressed to obtain the target compressed file; in addition, the first digital signature may be added to the differential file, for example, after the end position of the differential file, and the added first digital signature may be identified by a corresponding mark.
[0071] In step 109, the target compressed file is sent to a designated terminal to instruct the designated terminal to obtain a restored target file set according to the target compressed file and a third file set in the designated terminal, wherein the third file set is the same as the second file set.
[0072] In an embodiment of the present application, there may be multiple types of the designated terminal. For example, the designated terminal may be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, a server, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, and the like.
[0073] In the embodiment of the present application, generally speaking, the size of the target compressed file can be smaller than the first file set, so the target compressed file can be transmitted to the designated terminal, which can reduce the traffic consumption accordingly. At the same time, the target compressed file can be synthesized with the third file set in the designated terminal to obtain the restored target file set. Since the size of the storage area of each file in the target file set is an integer multiple of the preset threshold, when the designated terminal decompresses or otherwise processes the restored target file set, if it needs to read the restored target file set, it can read it with the preset threshold as the size of a single read, for example, it can read it through a cache area with a size of the preset threshold. At this time, since the size of the storage area of each file in the target file set is an integer multiple of the preset threshold, the file blocks obtained each time will only come from the same file, and there will be no situation where part of the file blocks obtained by reading the cache area once come from one file and the other part comes from another file, thereby greatly improving the information processing efficiency and facilitating subsequent analysis and processing.
[0074] In some embodiments, the first digital signature in the target compressed file is used to verify the restored target file set after obtaining the restored target file set.
[0075] Specifically, in some embodiments, after the target compressed file is sent to a designated terminal, a third file set in the designated terminal can be obtained, and the differential file in the target compressed file can be synthesized with the third file set, so that the designated terminal can obtain the restored target file set, and the restored target file set can be verified through the first digital signature in the target compressed file, so that the designated terminal can use the target file set to execute corresponding functions, such as decompression, installation, reading, etc.
[0076] In some embodiments, the restored target file set is used to be read from a cache area whose size is the preset threshold.
[0077] Exemplarily, the preset threshold value can be determined in advance according to the general setting mode of the cache area. For example, generally speaking, the size of the cache area is generally 8k, and the preset threshold value can be set to 8k. At this time, since the size of the storage area of each file in the target file set is an integer multiple of the preset threshold value, the file blocks obtained by each reading will only come from the same file, and there will be no situation where part of the file blocks obtained by reading the cache area once come from one file and the other part comes from another file, thereby greatly improving the information processing efficiency.
[0078] Optionally, in some embodiments, the first file set is obtained by decompressing a first compressed file, and the second file set is obtained by decompressing a second compressed file, and the second compressed file is a historical version file of the first compressed file;
[0079] The obtaining of the target compressed file including the differential file and the first digital signature comprises:
[0080] A target compressed file including the differential file and the first digital signature is obtained by compressing the file at a compression rate of 1.
[0081] In the embodiment of the present application, the first file set is not a compressed file, and therefore, the target file set is not a compressed file either. The differential file is obtained by performing a differential operation on the decompressed file set (i.e., the target file set and the second file set). At this time, the size of the differential file is often smaller than the size of the file obtained by directly performing a differential operation on the first compressed file and the second compressed file. Therefore, the size of the target compressed file to be transmitted is reduced, thereby greatly reducing the traffic consumption of related users and reducing the transmission time. Among them, the compression method with a compression rate of 1 can be a compression method that does not use a compression algorithm to process the differential file and the information of the first digital signature. At this time, after the target compressed file is transmitted to the designated terminal, the differential file part can be quickly extracted and synthesized with the third file set without spending more time to decompress the target compressed file.
[0082] In some embodiments, obtaining the first file set includes:
[0083] After receiving a download request for the first compressed file from a designated terminal, obtaining the first compressed file;
[0084] Obtaining historical version information of a third compressed file corresponding to a third file set in the designated terminal;
[0085] Decompressing the first compressed file to obtain the first file set;
[0086] The obtaining of the second file set comprises:
[0087] According to the historical version information, obtaining a second compressed file;
[0088] Decompress the second compressed file to obtain the second file set.
[0089] In the embodiment of the present application, the terminal device executing this embodiment may be a device that can provide corresponding download resources (such as a server or a specific mobile terminal, etc.). The historical version information may be used to identify the version of the corresponding file, for example, it may include a version number, a file name, etc.
[0090] After receiving the download request for the first compressed file from the designated terminal, the object for differential operation can be determined by acquiring the historical version information of the third compressed file in the designated terminal, wherein the third file set is obtained by decompressing the third compressed file.
[0091] For example, in some application scenarios, the user may need to update the application in the mobile terminal, and thus need to obtain the installation package of the new version of the application (i.e., the first compressed file), and the mobile terminal may contain the installation package of the old version (i.e., the third compressed file). Therefore, the mobile terminal can request the server to obtain the new version of the installation package through the application store. The server can obtain the historical version information of the old version of the installation package in the designated terminal from the designated terminal, so that the server can obtain the same file as the old version of the installation package in the mobile terminal (i.e., the second compressed file) and the new version of the installation package required by the mobile terminal, thereby decompressing the first compressed file to obtain the first file set, and decompressing the second compressed file to obtain the second file set, and then obtaining the differential file based on the first file set and the second file set.
[0092] In some embodiments, obtaining the first digital signature of the target file set includes:
[0093] The target file set is sent to a preset object, and a first digital signature returned by the preset object is received, wherein the preset object is an object for setting a second digital signature corresponding to the first file set.
[0094] In the embodiment of the present application, the preset object may be an object that provides the first file set, for example, it may be a developer of the first file set. In some cases, after receiving the target file set, the preset object may use the key used to generate the second digital signature to generate the first digital signature, and return it to the terminal device executing the embodiment of the present application.
[0095] In some embodiments, obtaining the first digital signature of the target file set includes:
[0096] A first digital signature of the target file set is generated according to a preset key, wherein the preset key is received in advance from the preset object, and the preset key is a key used to generate a second digital signature corresponding to the first file set.
[0097] In the embodiment of the present application, the preset key may be the preset object sent in advance to the terminal device executing the embodiment of the present application. At this time, the terminal device executing the embodiment of the present application can conveniently generate the first digital signature of the target file set.
[0098] As can be seen from the above, through the scheme of the present application, the terminal device can obtain a target file set in which the size of the storage area of each file is a positive integer multiple of a preset threshold, and obtain a differential file between the target file set and the second file set, and a first digital signature of the target file set; at this time, a target compressed file containing the differential file and the first digital signature can be obtained and sent to a designated terminal, wherein the differential file in the target compressed file is often smaller than that of the first file set, and therefore, the traffic consumption of information transmission can be reduced, and at the same time, the first digital signature can be used to verify the restored target file set after the designated terminal obtains the restored target file set, so that the designated terminal can use the restored target file set in compliance with the specification; and, since the size of the storage area of each file in the target file set is a positive integer multiple of the preset threshold, when reading the restored target file set in blocks, it can be read through a cache area with a size of the preset threshold, etc. At this time, since the size of the storage area of each file in the target file set is an integer multiple of the preset threshold, the file blocks obtained each time will only come from the same file, and there will be no situation where part of the file blocks obtained by reading the cache area once come from one file and the other part come from another file, thereby greatly improving the information processing efficiency.
[0099] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0100] Example 2
[0101] The present application embodiment provides a file processing device, which can be integrated into a terminal device, such as Figure 3 As shown, the file processing device 300 in the embodiment of the present application includes:
[0102] A first acquisition module 301 is used to acquire a first file set, where the first file set includes at least one first file;
[0103] A first determination module 302, used to determine the size of the storage area corresponding to each first file;
[0104] An expansion module 303 is used for expanding the storage area that does not meet the preset condition if the size of at least one storage area does not meet the preset condition, so that the size of the expanded storage area meets the preset condition, wherein the preset condition refers to that the size of the storage area is a positive integer multiple of a preset threshold;
[0105] A first processing module 304 is used to splice the first files in the first file set obtained after expanding the storage area that does not meet the preset condition to obtain a target file set;
[0106] A second acquisition module 305 is used to acquire a second file set, where the second file set is a historical version file set of the first file set;
[0107] A third acquisition module 306 is used to acquire a first digital signature of the target file set;
[0108] A second processing module 307 is used to obtain a differential file, wherein the differential file includes a first differential result obtained by performing a differential operation on the target file set and the second file set;
[0109] A third processing module 308 is used to obtain a target compressed file including the differential file and the first digital signature;
[0110] The sending module 309 is used to send the target compressed file to the designated terminal, so that the designated terminal can obtain the restored target file set according to the target compressed file and the third file set in the designated terminal, wherein the third file set is the same as the second file set.
[0111] Optionally, the second processing module 307 specifically includes:
[0112] A first acquisition unit, used to acquire a second digital signature corresponding to the first file set;
[0113] A first calculation unit, configured to perform a differential operation on the target file set and the second file set to obtain a first differential result;
[0114] a second computing unit, configured to perform a differential operation on the first digital signature and the second digital signature to obtain a second differential result;
[0115] A merging unit is used to merge the first difference result and the second difference result to obtain the difference file.
[0116] Optionally, the first file set is obtained by decompressing a first compressed file, and the second file set is obtained by decompressing a second compressed file, and the second compressed file is a historical version file of the first compressed file;
[0117] The third processing module 308 is specifically used for:
[0118] A target compressed file including the differential file and the first digital signature is obtained by compressing the file at a compression rate of 1.
[0119] Optionally, the first acquisition module 301 specifically includes:
[0120] A second obtaining unit, configured to obtain the first compressed file after receiving a download request for the first compressed file from a designated terminal;
[0121] A third acquisition unit, configured to acquire historical version information of a third compressed file corresponding to a third file set in the designated terminal;
[0122] A first decompression unit, used for decompressing the first compressed file to obtain the first file set;
[0123] The second acquisition module 305 includes:
[0124] A fourth acquisition unit, configured to acquire a second compressed file according to the historical version information;
[0125] The second decompression unit is used to decompress the second compressed file to obtain the second file set.
[0126] Optionally, the file types of the first file set and the second file set are both compressed files.
[0127] Optionally, the first digital signature in the target compressed file is used to verify the restored target file set after obtaining the restored target file set.
[0128] Optionally, the third acquisition module 306 is specifically used for:
[0129] The target file set is sent to a preset object, and a first digital signature returned by the preset object is received, wherein the preset object is an object for setting a second digital signature corresponding to the first file set.
[0130] Optionally, the third acquisition module 306 is specifically used for:
[0131] A first digital signature of the target file set is generated according to a preset key, wherein the preset key is received in advance from the preset object, and the preset key is a key used to generate a second digital signature corresponding to the first file set.
[0132] Optionally, the restored target file set is used to be read from a cache area whose size is the preset threshold.
[0133] As can be seen from the above, through the scheme of the present application, the terminal device can obtain a target file set in which the size of the storage area of each file is a positive integer multiple of a preset threshold, and obtain a differential file between the target file set and the second file set, and a first digital signature of the target file set; at this time, a target compressed file containing the differential file and the first digital signature can be obtained and sent to a designated terminal, wherein the differential file in the target compressed file is often smaller than that of the first file set, and therefore, the traffic consumption of information transmission can be reduced, and at the same time, the first digital signature can be used to verify the restored target file set after the designated terminal obtains the restored target file set, so that the designated terminal can use the restored target file set in compliance with the specification; and, since the size of the storage area of each file in the target file set is a positive integer multiple of the preset threshold, when reading the restored target file set in blocks, it can be read through a cache area with a size of the preset threshold, etc. At this time, since the size of the storage area of each file in the target file set is an integer multiple of the preset threshold, the file blocks obtained each time will only come from the same file, and there will be no situation where part of the file blocks obtained by reading the cache area once come from one file and the other part come from another file, thereby greatly improving the information processing efficiency.
[0134] Example 3
[0135] The present application embodiment provides a terminal device, see Figure 4 The terminal device in the embodiment of the present application includes: a memory 401, one or more processors 402 ( Figure 4 Only one is shown in the figure) and a computer program stored in the memory 401 and executable on the processor. Among them: the memory 401 is used to store software programs and modules, and the processor 402 executes various functional applications and data processing by running the software programs and units stored in the memory 401 to obtain the resources corresponding to the above-mentioned preset events. Specifically, the processor 402 implements the steps in the above-mentioned various file processing method embodiments by running the above-mentioned computer program stored in the memory 401.
[0136] Further, if Figure 4 As shown, the terminal device may further include: one or more input devices 403 ( Figure 4 ) and one or more output devices 404 (only one is shown) Figure 4 The memory 401 , the processor 402 , the input device 403 , and the output device 404 are connected via a bus 405 .
[0137] It should be understood that in the embodiment of the present application, the processor 402 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0138] The input device 403 may include a keyboard, a touch pad, a fingerprint sensor (for collecting the user's fingerprint information and fingerprint direction information), a microphone, etc., and the output device 404 may include a display, a speaker, etc.
[0139] The memory 401 may include a read-only memory and a random access memory, and provide instructions and data to the processor 402. A part or all of the memory 401 may also include a non-volatile random access memory. For example, the memory 401 may also store information on the device type.
[0140] As can be seen from the above, through the scheme of the present application, the terminal device can obtain a target file set in which the size of the storage area of each file is a positive integer multiple of a preset threshold, and obtain a differential file between the target file set and the second file set, and a first digital signature of the target file set; at this time, a target compressed file containing the differential file and the first digital signature can be obtained and sent to a designated terminal, wherein the differential file in the target compressed file is often smaller than that of the first file set, and therefore, the traffic consumption of information transmission can be reduced, and at the same time, the first digital signature can be used to verify the restored target file set after the designated terminal obtains the restored target file set, so that the designated terminal can use the restored target file set in compliance with the specification; and, since the size of the storage area of each file in the target file set is a positive integer multiple of the preset threshold, when reading the restored target file set in blocks, it can be read through a cache area with a size of the preset threshold, etc. At this time, since the size of the storage area of each file in the target file set is an integer multiple of the preset threshold, the file blocks obtained each time will only come from the same file, and there will be no situation where part of the file blocks obtained by reading the cache area once come from one file and the other part come from another file, thereby greatly improving the information processing efficiency.
[0141] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0142] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0143] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of external device software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0144] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of the above modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0145] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0146] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code can be in source code form, object code form, executable file or some intermediate form. The above-mentioned computer-readable storage medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer-readable memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the above-mentioned computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media does not include electrical carrier signals and telecommunication signals.
[0147] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned various file processing method embodiments when executing the computer program product.
[0148] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some of the technical features therein by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A file processing method, characterized in that: include: Acquire a first file set, where the first file set includes at least one first file; Determine the size of the storage area corresponding to each first file; If the size of at least one storage area does not meet the preset condition, the storage area that does not meet the preset condition is expanded so that the size of the expanded storage area meets the preset condition, wherein the preset condition refers to that the size of the storage area is a positive integer multiple of a preset threshold; After the storage area that does not meet the preset condition is expanded, each first file in the obtained first file set is merged to obtain a target file set, wherein the target file set includes the first file whose storage area size meets the preset condition and the first file whose storage area is expanded; Acquire a second file set, where the second file set is a historical version file set of the first file set; Obtaining a first digital signature of the target file set; Obtaining a differential file, wherein the differential file includes a first differential result obtained by performing a differential operation on the target file set and the second file set; Obtaining a target compressed file including the differential file and the first digital signature; Sending the target compressed file to a designated terminal to instruct the designated terminal to obtain a restored target file set according to the target compressed file and a third file set in the designated terminal, wherein the third file set is the same as the second file set; The obtaining of the differential file comprises: Obtaining a second digital signature corresponding to the first file set; Performing a differential operation on the target file set and the second file set to obtain a first differential result; Performing a differential operation on the first digital signature and the second digital signature to obtain a second differential result; The first difference result and the second difference result are combined to obtain the difference file.
2. The file processing method according to claim 1, characterized in that: The first file set is obtained by decompressing a first compressed file, and the second file set is obtained by decompressing a second compressed file, where the second compressed file is a historical version file of the first compressed file; The obtaining of the target compressed file including the differential file and the first digital signature comprises: A target compressed file including the differential file and the first digital signature is obtained by compressing the file at a compression rate of 1.
3. The file processing method according to claim 2, characterized in that: The obtaining of the first file set includes: After receiving a download request for the first compressed file from a designated terminal, obtaining the first compressed file; Obtaining historical version information of a third compressed file corresponding to a third file set in the designated terminal; Decompressing the first compressed file to obtain the first file set; The obtaining of the second file set comprises: According to the historical version information, obtaining a second compressed file; Decompress the second compressed file to obtain the second file set.
4. The file processing method according to claim 1, characterized in that: The file types of the first file set and the second file set are both compressed files.
5. The file processing method according to claim 1, characterized in that: The first digital signature in the target compressed file is used to verify the restored target file set after obtaining the restored target file set.
6. The file processing method according to claim 1, characterized in that: The obtaining of the first digital signature of the target file set comprises: The target file set is sent to a preset object, and a first digital signature returned by the preset object is received, wherein the preset object is an object for setting a second digital signature corresponding to the first file set.
7. The file processing method according to claim 1, characterized in that: The obtaining of the first digital signature of the target file set comprises: A first digital signature of the target file set is generated according to a preset key, wherein the preset key is received in advance from a preset object, and the preset key is a key used to generate a second digital signature corresponding to the first file set, wherein the preset object is an object for setting the second digital signature corresponding to the first file set.
8. The file processing method according to any one of claims 1 to 7, characterized in that: The restored target file set is read from a cache area whose size is the preset threshold.
9. A file processing device, characterized in that: include: A first acquisition module, used to acquire a first file set, wherein the first file set includes at least one first file; A first determination module, used to determine the size of the storage area corresponding to each first file; an expansion module, configured to expand the storage area that does not meet the preset condition if the size of at least one storage area does not meet the preset condition, so that the size of the expanded storage area meets the preset condition, wherein the preset condition refers to that the size of the storage area is a positive integer multiple of a preset threshold; A first processing module, configured to splice the first files in the first file set obtained after the storage area that does not meet the preset condition is expanded, to obtain a target file set, wherein the target file set includes the first file whose storage area size meets the preset condition and the first file whose storage area is expanded; A second acquisition module, used to acquire a second file set, where the second file set is a historical version file set of the first file set; A third acquisition module, used to obtain a first digital signature of the target file set; A second processing module, configured to obtain a differential file, wherein the differential file includes a first differential result obtained by performing a differential operation on the target file set and the second file set; A third processing module, used for obtaining a target compressed file including the differential file and the first digital signature; a sending module, configured to send the target compressed file to a designated terminal, so that the designated terminal can obtain a restored target file set according to the target compressed file and a third file set in the designated terminal, wherein the third file set is the same as the second file set; The second processing module comprises: A first acquisition unit, used to acquire a second digital signature corresponding to the first file set; A first calculation unit, configured to perform a differential operation on the target file set and the second file set to obtain a first differential result; a second calculation unit, configured to perform a differential operation on the first digital signature and the second digital signature to obtain a second differential result; A merging unit is used to merge the first differential result and the second differential result to obtain the differential file.
10. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the following steps are implemented: Acquire a first file set, where the first file set includes at least one first file; Determine the size of the storage area corresponding to each first file; If the size of at least one storage area does not meet the preset condition, the storage area that does not meet the preset condition is expanded so that the size of the expanded storage area meets the preset condition, wherein the preset condition refers to that the size of the storage area is a positive integer multiple of a preset threshold; After the storage area that does not meet the preset condition is expanded, each first file in the obtained first file set is spliced to obtain a target file set, wherein the target file set includes the first file whose storage area size meets the preset condition and the first file whose storage area is expanded; Acquire a second file set, where the second file set is a historical version file set of the first file set; Obtaining a first digital signature of the target file set; Obtaining a differential file, wherein the differential file includes a first differential result obtained by performing a differential operation on the target file set and the second file set; Obtaining a target compressed file including the differential file and the first digital signature; Sending the target compressed file to a designated terminal to instruct the designated terminal to obtain a restored target file set according to the target compressed file and a third file set in the designated terminal, wherein the third file set is the same as the second file set; The obtaining of the differential file comprises: Obtaining a second digital signature corresponding to the first file set; Performing a differential operation on the target file set and the second file set to obtain a first differential result; Performing a differential operation on the first digital signature and the second digital signature to obtain a second differential result; The first difference result and the second difference result are combined to obtain the difference file.
11. The terminal device according to claim 10, characterized in that: The first file set is obtained by decompressing a first compressed file, and the second file set is obtained by decompressing a second compressed file, where the second compressed file is a historical version file of the first compressed file; The obtaining of the target compressed file including the differential file and the first digital signature comprises: A target compressed file including the differential file and the first digital signature is obtained by compressing the file at a compression rate of 1.
12. The terminal device according to claim 11, characterized in that: The obtaining of the first file set includes: After receiving a download request for the first compressed file from a designated terminal, obtaining the first compressed file; Obtaining historical version information of a third compressed file corresponding to a third file set in the designated terminal; Decompressing the first compressed file to obtain the first file set; The obtaining of the second file set comprises: According to the historical version information, obtaining a second compressed file; Decompress the second compressed file to obtain the second file set.
13. The terminal device according to claim 10, characterized in that: The file types of the first file set and the second file set are both compressed files.
14. The terminal device according to claim 10, characterized in that: The first digital signature in the target compressed file is used to verify the restored target file set after obtaining the restored target file set.
15. The terminal device according to claim 10, characterized in that: The obtaining of the first digital signature of the target file set comprises: The target file set is sent to a preset object, and a first digital signature returned by the preset object is received, wherein the preset object is an object for setting a second digital signature corresponding to the first file set.
16. The terminal device according to claim 10, characterized in that: The obtaining of the first digital signature of the target file set comprises: A first digital signature of the target file set is generated according to a preset key, wherein the preset key is received in advance from a preset object, and the preset key is a key used to generate a second digital signature corresponding to the first file set, wherein the preset object is an object for setting the second digital signature corresponding to the first file set.
17. The terminal device according to any one of claims 10 to 16, characterized in that: The restored target file set is read from a cache area whose size is the preset threshold.
18. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the file processing method according to any one of claims 1 to 8 are implemented.
