A file processing method, a file processing device and a terminal device
Through file differential and compression parameter detection, the target compressed file is generated to reduce traffic consumption, solving the problem of large traffic consumption during file update, and improving transmission efficiency and user experience.
Patent Information
- Application Number
- CN201980100491.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-18
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2039-11-18
AI Technical Summary
During the file update process, the prior art is difficult to effectively reduce traffic consumption, especially because the incremental package size is large due to changes in compressed files, resulting in the terminal download traffic consumption still being large.
By obtaining the differential file of the file collection and detecting whether there is a compression parameter set, if it exists, obtaining a digital signature, generating a target compressed file containing compression parameter information, differential file and digital signature, sending it to the terminal to restore the corresponding file, reducing transmission file size.
It effectively reduces traffic consumption during file updates, improves information transmission efficiency, shortens transmission time, and improves user experience.
Smart Images

Figure CN114402286B_ABST
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, applications installed in terminals such as mobile terminals and wearable devices often need to download new versions of installation packages for upgrading, or a certain file needs to be updated, etc. Therefore, it is often necessary to obtain new versions of files 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 reduce corresponding traffic consumption when a designated terminal obtains a new version of a file for updating.
[0004] The first aspect of the present application provides a file processing method, comprising:
[0005] Obtaining a differential file between a first file set and a second file set, wherein the first file set is obtained by decompressing a first compressed file, 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;
[0006] detecting whether a first compression parameter set exists, where the first compression parameter set is used to compress the first file set, and a third compressed file obtained by compression is the same as the first compressed file;
[0007] If the first compression parameter set exists, obtaining a first digital signature of the first compressed file;
[0008] Obtaining a first target compressed file including first compression parameter information, the differential file and the first digital signature, wherein the first compression parameter information includes information about the first compression parameter set;
[0009] The first target compressed file is sent to a designated terminal to instruct the designated terminal to obtain a restored first compressed file according to the first target compressed file and a fourth compressed file in the designated terminal, wherein the fourth compressed file is the same as the second compressed file.
[0010] A second aspect of the present application provides a file processing device, comprising:
[0011] A first processing module is used to obtain a differential file between a first file set and a second file set, wherein the first file set is obtained by decompressing a first compressed file, 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;
[0012] A first detection module, used to detect whether a first compression parameter set exists, the first compression parameter set is used to compress the first file set, and a third compressed file obtained by compression is the same as the first compressed file;
[0013] A second processing module, configured to obtain a first digital signature of the first compressed file if the first compression parameter set exists;
[0014] The third processing module is used to obtain a first target compressed file including first compression parameter information, the differential file and the first digital signature, wherein the first compression parameter information includes information about the first compression parameter set.
[0015] The sending module is used to send the first target compressed file to a designated terminal to instruct the designated terminal to obtain a restored first compressed file according to the first target compressed file and a fourth compressed file in the designated terminal, wherein the fourth compressed file is the same as the second compressed file.
[0016] 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, and the processor implements the steps of the method of the first aspect when executing the computer program.
[0017] The fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method of the first aspect are implemented.
[0018] The 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 method of the first aspect are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] 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.
[0020] Figure 1 This is a schematic diagram of an implementation flow of the file processing method provided in an embodiment of the present application;
[0021] Figure 2 This is a schematic diagram of an implementation flow of the file processing method provided in an embodiment of the present application;
[0022] Figure 3 This is a schematic diagram of an implementation flow of detecting whether a first compression parameter set exists provided in an embodiment of the present application;
[0023] Figure 4 is a structural block diagram of a file processing device provided in an embodiment of the present application;
[0024] Figure 5 It is a schematic diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] 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.
[0026] In order to illustrate the above technical solution of the present application, a specific embodiment is provided below for illustration.
[0027] Example 1
[0028] The following describes a file processing method provided in an embodiment of the present application.
[0029] 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.
[0030] 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.
[0031] 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 order to reduce the user's traffic consumption, the corresponding server and other devices often transmit to the mobile terminal an incremental package of the new version of the installation package relative to the old version of the installation package in the mobile terminal, and the incremental package is often obtained by performing a differential operation on the new version of the installation package and the old version of the installation package. However, since the installation package is often a compressed package, even if there is a small change in the uncompressed file, the change in the compressed file obtained after compression will be very large, resulting in the size of the obtained incremental package itself is still very large. Therefore, even if the terminal downloads the corresponding incremental package, the traffic resources consumed are still very large.
[0032] In addition, for other files to be updated, there is also the problem of traffic consumption by obtaining the new version of the file.
[0033] In the embodiment of the present application, by executing the file processing method, the corresponding traffic consumption can be reduced when the designated terminal obtains a new version of the file for updating.
[0034] Among them, the file processing method in the embodiment of the present application includes:
[0035] In step 101, a differential file between a first file set and a second file set is obtained, wherein the first file set is obtained by decompressing a first compressed file, 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.
[0036] In an embodiment of the present application, the differential file is obtained by performing a differential operation on the first file set and the second 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 and Xdelta3. The number and file types of the files included in the first file set and the second file set are not limited here. In some embodiments, the second compressed file may be determined to be a historical version file of the first compressed file by information such as version number, file name, etc.
[0037] The method for obtaining the differential file can be determined according to the actual application scenario. For example, the differential file can be obtained by the terminal device executing the embodiment of the present application from other terminals through a specific information transmission method, or it can be obtained by the terminal device after receiving the relevant request sent by other terminals and obtaining the first file set and the second file set according to the relevant request.
[0038] In step 102, it is detected whether a first compression parameter set exists, the first compression parameter set is used to compress the first file set, and a third compressed file obtained by compression is the same as the first compressed file.
[0039] In some embodiments, the provider of the first compressed file (such as a developer) often does not provide compression information such as specific compression parameters and specific compression algorithms corresponding to the first compressed file. After the first compressed file is decompressed to obtain the first file set, when the first file set is compressed again, if the new compressed file obtained is different from the first compressed file, even if the difference is 1 bit, when the new compressed file is verified by the digital signature of the first compressed file, the new compressed file will be illegal. Therefore, in the embodiment of the present application, the first compression parameter set can be obtained by detection, and the first file set can be compressed to obtain a third compressed file that is the same as the first compressed file. At this time, the digital signature of the first compressed file can be used to verify the third compressed file, so that the provider of the first compressed file does not need to provide the digital signature of the third compressed file again, thereby improving processing efficiency.
[0040] In an embodiment of the present application, the first compression parameter set may include one or more compression parameters, and in some embodiments, the first compression parameter set may also include one or more first compression parameter subsets, wherein each first compression parameter subset may correspond to a file in the first file set, and the files corresponding to each first compression parameter subset are different. Any of the first compression parameter subsets may be used to compress the corresponding file, and there may be differences between each first compression parameter subset, and of course, they may also be the same. The compression parameter may be determined according to a specific compression algorithm, application scenario, and the like.
[0041] In some embodiments, the first compression parameter set may include at least one of a parameter for indicating a compression algorithm, a parameter for indicating an encoding method, a parameter for indicating a degree of compression, and a parameter for indicating a check field status.
[0042] In the embodiment of the present application, the parameters may be in the form of preset numbers, text, symbol numbers, etc. The parameters may be independent of each other or may be associated with each other. For example, since the specific parameters corresponding to different compression algorithms may be different, the parameters used to indicate different compression algorithms, the corresponding parameters used to indicate the encoding method and the parameters used to indicate the degree of compression may be different.
[0043] The following is a specific example to illustrate.
[0044] Exemplarily, in an application scenario, the compression algorithm detected is determined to be the Deflate compression algorithm. Then, when detecting whether a first compression parameter set exists, the parameters for indicating the encoding method, the parameters for indicating the degree of compression, and the parameters for indicating the status of the check field in the Deflate compression algorithm can be detected to determine whether a first compression parameter set exists.
[0045] Wherein, the compression algorithm detected is determined to be the Deflate compression algorithm, then, when detecting whether there is a first compression parameter set, the parameters detected may include strategy, level and nowrap. Specifically, the parameter indicating the encoding method may be named strategy, and the value of strategy may be 0-4, wherein 0 indicates that it is used for ordinary data, 1 indicates that it is used for data generated by a filter (or a predictor), 2 indicates that it is used for forced Huffman coding, 3 indicates that the matching length is limited to 1, and 4 indicates that dynamic Huffman coding is prohibited. The parameter used to indicate the degree of compression may be named level, and the level may have three values, wherein 0 indicates no compression, 1 indicates that the speed is prioritized and the degree of compression is higher than 0, and 9 indicates that compression is prioritized, the degree of compression is higher than 1, and the compression speed is slower than 1. The parameter used to indicate the status of the check field may be named nowrap, and the nowrap may indicate whether to use the zlib check header, wherein the nowrap may have two values, 1 indicates that the zlib check header and check field are not used, and 0 indicates that the zlib check header and check field are used. The strategy, the level and the nowrap may also have other values to represent other meanings.
[0046] In step 103, if the first compression parameter set exists, a first digital signature of the first compressed file is obtained.
[0047] In the embodiment of the present application, if there is a first compression parameter set, the first file set can be compressed to obtain a third compressed file that is the same as the first compressed file. At this time, the digital signature of the first compressed file can be used to verify the third compressed file, so that the provider of the first compressed file does not need to re-provide the digital signature of the third compressed file.
[0048] In the embodiment of the present application, generally, the first digital signature of the first compressed file is included in the first compressed file, so the first digital signature can be directly extracted from the first compressed file. Of course, the first digital signature of the first compressed file can also be generated according to the private key provided by the provider of the first compressed file (such as the developer).
[0049] In step 104, a first target compressed file including first compression parameter information, the differential file and the first digital signature is obtained, wherein the first compression parameter information includes information about the first compression parameter set.
[0050] In an embodiment of the present application, the first target compressed file, the first compression parameter information, the differential file and the first digital signature may exist in multiple forms. Exemplarily, a first file containing information of the first compression parameter set may be generated, and a second file containing information of the first digital signature may be generated, and a target compressed file containing a differential file and the first and second files may be generated. Alternatively, the first compression parameter information and / or 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 compression parameter information and / or the first digital signature may be identified by a corresponding mark.
[0051] In step 105, the first target compressed file is sent to a designated terminal to instruct the designated terminal to obtain a restored first compressed file according to the first target compressed file and a fourth compressed file in the designated terminal, wherein the fourth compressed file is the same as the second compressed file.
[0052] 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.
[0053] Among them, since the differential file is obtained by decompressing the first compressed file and the second compressed file, at this time, the size of the first target compressed 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, in information transmission, the traffic consumption of related users can be greatly reduced and the transmission time can be reduced.
[0054] In some embodiments, the first digital signature in the first target compressed file is used to verify the restored first compressed file after obtaining the restored first compressed file.
[0055] Specifically, in some embodiments, after sending the first target compressed file to the designated terminal, the decompressed third file set of the fourth compressed file in the designated terminal can be obtained, and the differential file in the first target compressed file can be synthesized with the third file set, so that the designated terminal can obtain the restored first file set, and then obtain the restored first compressed file based on the first compression parameter information, so that the restored first compressed file can be verified by the first digital signature, so that the designated terminal can use the first compressed file, execute corresponding functions, install, read, etc.
[0056] like Figure 2 As shown, optionally, in some embodiments, the file processing method may further include the following steps:
[0057] Step 201: if the first compression parameter set does not exist, determining a second compression parameter set according to compression speed, compression ratio and / or compressed file similarity, wherein the compressed file similarity is the similarity between a fifth compressed file obtained by compressing the first file set according to the second compression parameter set and the first compressed file;
[0058] Step 202: compress the first file set according to the second compression parameter set to obtain a fifth compressed file;
[0059] Step 203, obtaining a second digital signature of the fifth compressed file;
[0060] Step 204: Obtain a second target compressed file including second compression parameter information, the differential file, and the second digital signature, wherein the second compression parameter information includes information of the second compression parameter set.
[0061] In the embodiment of the present application, the compression speed, compression ratio and / or compressed file similarity can be considered as influencing factors affecting the determination of the second compression parameter set, and the selection of the influencing factors can be determined according to actual needs. Exemplarily, it can be predetermined which one or more influencing factors are used to determine the second compression parameter set, or it can be determined which one or more influencing factors are used to determine the second compression parameter set according to at least one of the status information of the designated terminal and the size of the differential file, wherein the status information of the designated terminal can include the network connection status of the designated terminal, etc. For example, if the differential file is large, the second compression parameter set can be determined according to the compression ratio.
[0062] In the embodiment of the present application, since the fifth compressed file is different from the first compressed file, the digital signature of the first compressed file cannot be used to verify the fifth compressed file. Specifically, the fifth compressed file can be transmitted to the provider of the first compressed file, and the second digital signature of the provider for the fifth compressed file can be obtained; or the second digital signature of the fifth compressed file can be generated according to the private key provided by the provider of the first compressed file (such as the developer).
[0063] In some embodiments, obtaining the digital signature of the fifth compressed file includes:
[0064] The fifth compressed file is sent to a preset object, and a second digital signature returned by the preset object is received, wherein the preset object is an object for setting the first digital signature of the first compressed file.
[0065] In the embodiment of the present application, the preset object may be an object that provides the first compressed file, for example, it may be a developer of the first compressed file. Exemplarily, after receiving the fifth compressed file, the preset object may use the key used to generate the first digital signature to generate the second digital signature, and return it to the terminal device executing the embodiment of the present application.
[0066] In some embodiments, obtaining the digital signature of the fifth compressed file includes:
[0067] A second digital signature of the fifth compressed file 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 the first digital signature.
[0068] 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 second digital signature of the fifth compressed file.
[0069] Optionally, in some embodiments, step S101 may include the following steps:
[0070] A1. After receiving a download request for a first compressed file from a designated terminal, obtaining historical version information of a fourth compressed file in the designated terminal;
[0071] A2. Obtain a second compressed file according to the historical version information;
[0072] A3. Obtain a first compressed file;
[0073] A4. Obtain a differential file between the first file set and the second file set according to the first compressed file and the second compressed file.
[0074] 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.
[0075] After receiving the download request for the first compressed file from the designated terminal, the object for performing the differential operation can be determined by acquiring the historical version information in the designated terminal.
[0076] 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 fourth compressed file). Therefore, the mobile terminal may request the server to obtain the installation package of the new version through the application store. The server may obtain the historical version information of the installation package of the old version in the designated terminal from the designated terminal, so that the server can obtain the same file as the installation package of the old version in the mobile terminal (i.e., the second compressed file) and the installation package of the new version required by the mobile terminal, so as to obtain the differential file according to the second compressed file and the first compressed file.
[0077] Optionally, in some embodiments, the detecting whether the first compression parameter set exists includes:
[0078] For any first file in the first file set, detecting whether a first compression parameter exists, the first compression parameter being used to compress the first file to obtain a first compressed sub-file, the first compressed sub-file having a corresponding identical part in the first compressed file;
[0079] Each first file in the first file set is traversed to detect whether each first file has a corresponding first compression parameter, wherein the first compression parameter set includes each first compression parameter.
[0080] In the embodiment of the present application, a compressed portion corresponding to the first file can be determined in the first compressed file, and the compressed portion can be detected to see whether it is the same as the first compressed sub-file of the first file. Of course, the first compressed sub-file can also be directly compared with the first compressed file to determine that the first compressed sub-file has a corresponding identical portion in the first compressed file.
[0081] In some cases, since the types of the first files in the first file set may be different and the compression methods for different types of files may be different, the first compression parameter corresponding to each first file may be determined separately to improve the accuracy of detection.
[0082] In some embodiments, for any first file in the first file set, detecting whether a first compression parameter exists includes:
[0083] For any first file in the first file set, determining at least two sets of compression parameters to be verified;
[0084] In a parallel manner, it is detected whether the first compression parameter exists in the at least two groups of compression parameters to be verified.
[0085] In an embodiment of the present application, the parallel method can be implemented through different processing processes (or different threads). Generally, the parameters included in a set of compression parameters to be verified may include one or more parameters involved in a compression process. For example, the set of compression parameters to be verified may include parameters for indicating a compression algorithm, parameters for indicating an encoding method, parameters for indicating a degree of compression, and parameters for indicating a check field condition. Since the detection of each set of compression parameters to be verified is independent of each other, it is possible to detect in parallel whether the first compression parameter exists in the at least two sets of compression parameters to be verified, thereby greatly improving the detection efficiency.
[0086] The following is a specific example to illustrate the application of the embodiment of the present application in a specific application scenario.
[0087] like Figure 3 The figure is a schematic diagram of an implementation flow of detecting whether a first compression parameter set exists provided in an embodiment of the present application.
[0088] Among them, a first file in the first file set includes new file 1, new file 2 and new file 3, etc. Among them, for new file 1, multiple groups of compression parameters to be verified corresponding to new file 1 are determined. Among them, the compression parameters to be verified include strategy, level and nowrap, wherein the parameter indicating the encoding method can be named strategy, and the value of strategy can be 0-4, wherein 0 indicates that it is used for ordinary data, 1 indicates that it is used for data generated by a filter filter (or called a predictor predictor), 2 indicates that it is used for forced Huffman coding, 3 indicates that the matching length is limited to 1, and 4 indicates that dynamic Huffman coding is prevented. The parameter used to indicate the degree of compression can be named level, and the level can have three values, wherein 0 indicates no compression, 1 indicates that the speed priority compression degree is higher than 0, and 9 indicates that compression priority, the compression degree is higher than 1, and the compression speed is slower than 1. The parameter used to indicate the status of the check field can be named nowrap, and the nowrap can indicate whether to use the zlib check header. The nowrap can have two values, 1 indicates not using the zlib check header and check field, and 0 indicates using the zlib check header and check field.
[0089] At this time, the values of strategy, level and nowrap in each group of compression parameters to be verified can be set and determined respectively. Since there are 5 values of the strategy, 3 values of the level, and 2 values of the nowrap, there can be 5*3*2=30 values of the compression parameters to be verified. At this time, 30 threads can be used to respectively detect whether the compressed sub-files to be verified obtained by compressing the first file by each group of compression parameters to be verified have corresponding identical parts in the first compressed file; if there is a compressed sub-file to be verified that has a corresponding identical part in the first compressed file, the compression parameter to be verified corresponding to the compressed sub-file to be verified is the first compression parameter of the first file.
[0090] The same method can be used for other files in the first file set, such as new file 2 and new file 3. It should be noted that the compression parameters to be verified corresponding to other files can be different from or the same as those of the new file 1. This is not limited here.
[0091] As can be seen from the above, in the present application, since the differential file is obtained by decompressing the first compressed file and the second compressed file, at this time, the size of the first target compressed 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, in the subsequent information transmission, the traffic consumption of the relevant users can be greatly reduced, and the transmission time can be reduced. In addition, by detecting the first compression parameter set, a third compressed file that is the same as the first compressed file can be obtained; at this time, the digital signature of the first compressed file can be used to verify the third compressed file, so that the provider of the first compressed file does not need to re-provide the digital signature of the third compressed file, which improves the efficiency of information processing, shortens the time required for information processing, and thus improves the user experience.
[0092] 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.
[0093] Example 2
[0094] The present application embodiment provides a file processing device, which can be integrated into a terminal device, such as Figure 4 As shown, the file processing device 4 in the embodiment of the present application includes:
[0095] The first processing module 401 is used to obtain a differential file between a first file set and a second file set, wherein the first file set is obtained by decompressing a first compressed file, 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;
[0096] A first detection module 402 is used to detect whether there is a first compression parameter set, the first compression parameter set is used to compress the first file set, and the third compressed file obtained by compression is the same as the first compressed file;
[0097] A second processing module 403 is configured to obtain a first digital signature of the first compressed file if the first compression parameter set exists;
[0098] The third processing module 404 is used to obtain a first target compressed file including first compression parameter information, the differential file and the first digital signature, wherein the first compression parameter information includes information about the first compression parameter set.
[0099] The sending module 405 is used to send the first target compressed file to a designated terminal to instruct the designated terminal to obtain a restored first compressed file according to the first target compressed file and a fourth compressed file in the designated terminal, wherein the fourth compressed file is the same as the second compressed file.
[0100] Optionally, the file processing device 4 further includes:
[0101] a first determination module, configured to determine a second compression parameter set according to a compression speed, a compression ratio and / or a degree of similarity of compressed files if the first compression parameter set does not exist, wherein the degree of similarity of compressed files is a degree of similarity between a fifth compressed file obtained by compressing the first file set according to the second compression parameter set and the first compressed file;
[0102] a fourth processing module, configured to compress the first file set according to the second compression parameter set to obtain a fifth compressed file;
[0103] A first acquisition module, used to acquire a second digital signature of the fifth compressed file;
[0104] The fifth processing module is used to obtain a second target compressed file including second compression parameter information, the differential file and the second digital signature, wherein the second compression parameter information includes information of the second compression parameter set.
[0105] Optionally, the first acquisition module is specifically used to:
[0106] The fifth compressed file is sent to a preset object, and a second digital signature returned by the preset object is received, wherein the preset object is an object for setting the first digital signature of the first compressed file.
[0107] Optionally, the first acquisition module is specifically used to:
[0108] A second digital signature of the fifth compressed file 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 the first digital signature.
[0109] Optionally, the first processing module 401 specifically includes:
[0110] A first acquiring unit is configured to acquire historical version information of a fourth compressed file in the designated terminal after receiving a download request for the first compressed file from the designated terminal;
[0111] A second acquisition unit, used to acquire a second compressed file according to the historical version information;
[0112] A third obtaining unit, used to obtain the first compressed file;
[0113] The first processing unit is used to obtain a differential file between a first file set and a second file set according to the first compressed file and the second compressed file.
[0114] Optionally, in an embodiment of the present application, the first digital signature in the first target compressed file is used to verify the restored first compressed file after obtaining the restored first compressed file.
[0115] Optionally, in an embodiment of the present application, the first compression parameter set includes at least one of a parameter for indicating a compression algorithm, a parameter for indicating an encoding method, a parameter for indicating a degree of compression, and a parameter for indicating a check field status.
[0116] Optionally, the first detection module 402 specifically includes:
[0117] A first detection unit is used to detect, for any first file in the first file set, whether a first compression parameter exists, the first compression parameter is used to compress the first file to obtain a first compressed sub-file, and the first compressed sub-file has a corresponding identical part in the first compressed file;
[0118] The second detection unit is used to traverse each first file in the first file set and detect whether each first file has a corresponding first compression parameter, wherein the first compression parameter set includes each first compression parameter.
[0119] Optionally, the first detection unit specifically includes:
[0120] A determination subunit, configured to determine at least two groups of compression parameters to be verified for any first file in the first file set;
[0121] The detection subunit is used to detect in parallel whether the first compression parameter exists in the at least two groups of compression parameters to be verified.
[0122] As can be seen from the above, through the present application scheme, since the differential file is obtained by decompressing the first compressed file and the second compressed file, at this time, the size of the first target compressed 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, in the subsequent information transmission, the traffic consumption of the relevant users can be greatly reduced, and the transmission time can be reduced. In addition, by detecting the first compression parameter set, a third compressed file that is the same as the first compressed file can be obtained; at this time, the digital signature of the first compressed file can be used for the verification of the third compressed file, so that the provider of the first compressed file does not need to re-provide the digital signature of the third compressed file, which improves the efficiency of information processing, shortens the time required for information processing, and thus improves the user experience.
[0123] Example 3
[0124] The present application embodiment provides a terminal device, see Figure 5 The terminal device in the embodiment of the present application includes: a memory 501, one or more processors 502 ( Figure 5 Only one is shown) and a computer program stored in the memory 501 and executable on the processor. The memory 501 is used to store software programs and modules, and the processor 502 executes various functional applications and data processing by running the software programs and units stored in the memory 501 to obtain the resources corresponding to the above-mentioned preset events. Specifically, the processor 502 implements the steps in any of the above-mentioned file processing method embodiments by running the above-mentioned computer program stored in the memory 501.
[0125] Further, if Figure 5 As shown, the terminal device may further include: one or more input devices 503 ( Figure 5 ) and one or more output devices 504 (only one is shown) Figure 5 The memory 501 , the processor 502 , the input device 503 and the output device 504 are connected via a bus 505 .
[0126] It should be understood that in the embodiment of the present application, the processor 502 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.
[0127] The input device 503 may include a keyboard, a touchpad, a fingerprint sensor (for collecting the user's fingerprint information and fingerprint direction information), a microphone, etc., and the output device 504 may include a display, a speaker, etc.
[0128] The memory 501 may include a read-only memory and a random access memory, and provide instructions and data to the processor 502. A part or all of the memory 501 may also include a non-volatile random access memory. For example, the memory 501 may also store information on the device type.
[0129] As can be seen from the above, through the present application scheme, since the differential file is obtained by decompressing the first compressed file and the second compressed file, at this time, the size of the first target compressed 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, in the subsequent information transmission, the traffic consumption of the relevant users can be greatly reduced, and the transmission time can be reduced. In addition, by detecting the first compression parameter set, a third compressed file that is the same as the first compressed file can be obtained; at this time, the digital signature of the first compressed file can be used for the verification of the third compressed file, so that the provider of the first compressed file does not need to re-provide the digital signature of the third compressed file, which improves the efficiency of information processing, shortens the time required for information processing, and thus improves the user experience.
[0130] 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.
[0131] 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.
[0132] 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.
[0133] 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.
[0134] 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.
[0135] 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.
[0136] 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.
[0137] 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: Obtaining a differential file between a first file set and a second file set, wherein the first file set is obtained by decompressing a first compressed file, 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; detecting whether a first compression parameter set exists, where the first compression parameter set is used to compress the first file set, and a third compressed file obtained by compression is the same as the first compressed file; If the first compression parameter set exists, obtaining a first digital signature of the first compressed file; Obtaining a first target compressed file including first compression parameter information, the differential file and the first digital signature, wherein the first compression parameter information includes information about the first compression parameter set; Sending the first target compressed file to a designated terminal to instruct the designated terminal to obtain a restored first compressed file according to the first target compressed file and a fourth compressed file in the designated terminal, wherein the fourth compressed file is the same as the second compressed file; The method further comprises: If the first compression parameter set does not exist, determining a second compression parameter set according to compression speed, compression ratio and / or compressed file similarity, wherein the compressed file similarity is a similarity between a fifth compressed file obtained by compressing the first file set according to the second compression parameter set and the first compressed file; compressing the first file set according to the second compression parameter set to obtain a fifth compressed file; Obtaining a second digital signature of the fifth compressed file; A second target compressed file including second compression parameter information, the differential file and the second digital signature is obtained, wherein the second compression parameter information includes information of the second compression parameter set.
2. The file processing method according to claim 1, characterized in that: The step of obtaining the digital signature of the fifth compressed file comprises: The fifth compressed file is sent to a preset object, and a second digital signature returned by the preset object is received, wherein the preset object is an object for setting the first digital signature of the first compressed file.
3. The file processing method according to claim 1, characterized in that: The step of obtaining the digital signature of the fifth compressed file comprises: A second digital signature of the fifth compressed file 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 the first digital signature.
4. The file processing method according to claim 1, characterized in that: The step of obtaining a differential file between the first file set and the second file set includes: After receiving a download request for the first compressed file from a designated terminal, acquiring historical version information of a fourth compressed file in the designated terminal; According to the historical version information, obtaining a second compressed file; Get the first compressed file; A differential file between a first file set and a second file set is obtained according to the first compressed file and the second compressed file.
5. The file processing method according to claim 1, characterized in that: The first digital signature in the first target compressed file is used to verify the restored first compressed file after obtaining the restored first compressed file.
6. The file processing method according to claim 1, characterized in that: The first compression parameter set includes at least one of a parameter for indicating a compression algorithm, a parameter for indicating an encoding method, a parameter for indicating a compression degree, and a parameter for indicating a check field status.
7. The file processing method according to any one of claims 1 to 6, characterized in that: The detecting whether the first compression parameter set exists includes: For any first file in the first file set, detecting whether a first compression parameter exists, the first compression parameter being used to compress the first file to obtain a first compressed sub-file, the first compressed sub-file having a corresponding identical part in the first compressed file; Each first file in the first file set is traversed to detect whether each first file has a corresponding first compression parameter, wherein the first compression parameter set includes each first compression parameter.
8. The file processing method according to claim 7, characterized in that: The detecting, for any first file in the first file set, whether a first compression parameter exists includes: For any first file in the first file set, determining at least two sets of compression parameters to be verified; In a parallel manner, it is detected whether the first compression parameter exists in the at least two groups of compression parameters to be verified.
9. A file processing device, characterized in that: include: A first processing module is used to obtain a differential file between a first file set and a second file set, wherein the first file set is obtained by decompressing a first compressed file, 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; A first detection module, used to detect whether a first compression parameter set exists, the first compression parameter set is used to compress the first file set, and a third compressed file obtained by compression is the same as the first compressed file; A second processing module, configured to obtain a first digital signature of the first compressed file if the first compression parameter set exists; A third processing module, configured to obtain a first target compressed file including first compression parameter information, the differential file and the first digital signature, wherein the first compression parameter information includes information about the first compression parameter set; a sending module, configured to send the first target compressed file to a designated terminal, so as to instruct the designated terminal to obtain a restored first compressed file according to the first target compressed file and a fourth compressed file in the designated terminal, wherein the fourth compressed file is the same as the second compressed file; The file processing device also includes: a first determination module, configured to determine a second compression parameter set according to a compression speed, a compression ratio and / or a degree of similarity of compressed files if the first compression parameter set does not exist, wherein the degree of similarity of compressed files is a degree of similarity between a fifth compressed file obtained by compressing the first file set according to the second compression parameter set and the first compressed file; a fourth processing module, configured to compress the first file set according to the second compression parameter set to obtain a fifth compressed file; A first acquisition module, used to acquire a second digital signature of the fifth compressed file; The fifth processing module is used to obtain a second target compressed file including second compression parameter information, the differential file and the second digital signature, wherein the second compression parameter information includes information of the second compression parameter set.
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: Obtaining a differential file between a first file set and a second file set, wherein the first file set is obtained by decompressing a first compressed file, 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; detecting whether a first compression parameter set exists, where the first compression parameter set is used to compress the first file set, and a third compressed file obtained by compression is the same as the first compressed file; If the first compression parameter set exists, obtaining a first digital signature of the first compressed file; Obtaining a first target compressed file including first compression parameter information, the differential file and the first digital signature, wherein the first compression parameter information includes information about the first compression parameter set; Sending the first target compressed file to a designated terminal to instruct the designated terminal to obtain a restored first compressed file according to the first target compressed file and a fourth compressed file in the designated terminal, wherein the fourth compressed file is the same as the second compressed file; When the processor executes the computer program, the processor further implements the following steps: If the first compression parameter set does not exist, determining a second compression parameter set according to compression speed, compression ratio and / or compressed file similarity, wherein the compressed file similarity is a similarity between a fifth compressed file obtained by compressing the first file set according to the second compression parameter set and the first compressed file; compressing the first file set according to the second compression parameter set to obtain a fifth compressed file; Obtaining a second digital signature of the fifth compressed file; A second target compressed file including second compression parameter information, the differential file and the second digital signature is obtained, wherein the second compression parameter information includes information of the second compression parameter set.
11. The terminal device according to claim 10, characterized in that: When the processor executes the computer program, obtaining the digital signature of the fifth compressed file includes: The fifth compressed file is sent to a preset object, and a second digital signature returned by the preset object is received, wherein the preset object is an object for setting the first digital signature of the first compressed file.
12. The terminal device according to claim 10, characterized in that: When the processor executes the computer program, obtaining the digital signature of the fifth compressed file includes: A second digital signature of the fifth compressed file 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 the first digital signature.
13. The terminal device according to claim 10, characterized in that: When the processor executes the computer program, obtaining a differential file between the first file set and the second file set includes: After receiving a download request for the first compressed file from a designated terminal, acquiring historical version information of a fourth compressed file in the designated terminal; According to the historical version information, obtaining a second compressed file; Get the first compressed file; A differential file between a first file set and a second file set is obtained according to the first compressed file and the second compressed file.
14. The terminal device according to claim 10, characterized in that: When the processor executes the computer program, the first digital signature in the first target compressed file is used to verify the restored first compressed file after obtaining the restored first compressed file.
15. The terminal device according to claim 10, characterized in that: When the processor executes the computer program, the first compression parameter set includes at least one of a parameter for indicating a compression algorithm, a parameter for indicating an encoding method, a parameter for indicating a compression degree, and a parameter for indicating a check field status.
16. The terminal device according to any one of claims 10 to 15, characterized in that: When the processor executes the computer program, detecting whether a first compression parameter set exists includes: For any first file in the first file set, detecting whether a first compression parameter exists, the first compression parameter being used to compress the first file to obtain a first compressed sub-file, the first compressed sub-file having a corresponding identical part in the first compressed file; Each first file in the first file set is traversed to detect whether each first file has a corresponding first compression parameter, wherein the first compression parameter set includes each first compression parameter.
17. The terminal device according to claim 16, characterized in that: When the processor executes the computer program, detecting whether a first compression parameter exists for any first file in the first file set includes: For any first file in the first file set, determining at least two sets of compression parameters to be verified; In a parallel manner, it is detected whether the first compression parameter exists in the at least two groups of compression parameters to be verified.
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.
