CN114402286A - File processing method, file processing device and terminal equipment - Google Patents

File processing method, file processing device and terminal equipment Download PDF

Info

Publication number
CN114402286A
CN114402286A CN201980100491.8A CN201980100491A CN114402286A CN 114402286 A CN114402286 A CN 114402286A CN 201980100491 A CN201980100491 A CN 201980100491A CN 114402286 A CN114402286 A CN 114402286A
Authority
CN
China
Prior art keywords
file
compressed file
compressed
compression
compression parameter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201980100491.8A
Other languages
Chinese (zh)
Inventor
赵杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Shenzhen Huantai Technology Co Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Shenzhen Huantai Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd, Shenzhen Huantai Technology Co Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Publication of CN114402286A publication Critical patent/CN114402286A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a file processing method, which comprises the following steps: obtaining a differential file of 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 history version file of the first compressed file; detecting whether a first compression parameter set exists or not, wherein the first compression parameter set is used for compressing 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, acquiring a first digital signature of the first compressed file; obtaining a first target compressed file comprising first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information comprises information about the first set of compression parameters; and sending the first target compressed file to a designated terminal.

Description

File processing method, file processing device and terminal equipment Technical Field
The present application belongs to the field of information processing technologies, and in particular, relates to a file processing method, a file processing apparatus, a terminal device, and a computer-readable storage medium.
Background
Currently, many files often need to be updated due to the fast update speed of information. For example, applications installed in terminals such as mobile terminals, wearable devices, etc. often need to download new versions of installation packages for upgrades, or certain files need to be version updated, etc. Therefore, it is often necessary to obtain a new version of a file for updating.
Disclosure of Invention
The application provides a file processing method, a file processing device, a terminal device and a computer readable storage medium, which can reduce corresponding flow consumption when a designated terminal acquires a new version of a file for updating.
A first aspect of the present application provides a file processing method, including:
obtaining a differential file of 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 history version file of the first compressed file;
detecting whether a first compression parameter set exists or not, wherein the first compression parameter set is used for compressing 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, acquiring a first digital signature of the first compressed file;
obtaining a first target compressed file comprising first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information comprises information about the first set of compression parameters;
and 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.
A second aspect of the present application provides a document processing apparatus comprising:
the system comprises a first processing module, a second processing module and a third processing module, wherein the first processing module is used for obtaining a differential file of a first file set and a second file set, 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;
the first detection module is used for detecting whether a first compression parameter set exists or not, the first compression parameter set is used for compressing the first file set, and a third compressed file obtained by compression is the same as the first compressed file;
the second processing module is used for acquiring a first digital signature of the first compressed file if the first compressed parameter set exists;
a third processing module to obtain a first target compressed file comprising first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information comprises information about the first set of compression parameters.
And the sending module is used for sending 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.
A third aspect of the present application provides a terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to the first aspect when executing the computer program.
A fourth aspect of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of the first aspect as described above.
A fifth aspect of the application provides a computer program product comprising a computer program which, when executed by one or more processors, performs the steps of the method as described in the first aspect above.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic flow chart of an implementation of a document processing method provided in an embodiment of the present application;
FIG. 2 is a schematic flow chart of an implementation of a document processing method provided in an embodiment of the present application;
FIG. 3 is a flow chart illustrating an implementation of detecting whether a first set of compression parameters exists according to an embodiment of the present disclosure;
FIG. 4 is a block diagram of a document processing apparatus according to an embodiment of the present application;
fig. 5 is a schematic diagram of a terminal device provided in an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
In order to explain the technical solution of the present application, the following description will be given by way of specific examples.
Example 1
A file processing method provided in an embodiment of the present application is described below.
Fig. 1 is a schematic diagram illustrating an implementation flow of a file processing method according to an embodiment of the present application. The file processing method can be applied to terminal equipment.
The types of the terminal devices to which the embodiments of the present application can be applied may be various. For example, the terminal device may be a server, a mobile phone, a tablet Computer, a wearable device, an in-vehicle 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), and the like. The embodiment of the present application does not set any limit to the specific type of the terminal device.
In some scenarios, files in some terminals may often need to be updated. For example, an application installed in a mobile terminal often needs to download a new version of an installation package for upgrading, or a certain file needs to be updated in version, and the like. In some cases, when an application in a mobile terminal needs to be upgraded, a user may obtain a new version of an installation package of the application through a browser, an application store, and the like in the mobile terminal. In order to reduce traffic consumption of a user, a corresponding device such as a server often transmits an incremental package of the new version of the installation package relative to an old version of the installation package in the mobile terminal to the mobile terminal, and the incremental package is often obtained by performing 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, and even a small change in the uncompressed file results in a large change in the compressed file after compression, the size of the obtained delta package itself is still large. Therefore, even if the terminal downloads the corresponding incremental package, the consumed traffic resource is still large.
In addition, for other files to be updated, the problem of consumption of traffic by the new version of the file to be acquired also exists.
In the embodiment of the application, by executing the file processing method, when the designated terminal acquires the new version of the file for updating, the corresponding flow consumption can be reduced.
The file processing method in the embodiment of the application comprises the following steps:
in step 101, a differential file of a first file set and a second file set is obtained, where 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 history version file of the first compressed file.
In this embodiment of the application, the differential file is obtained by performing a differential operation on the first file set and the second file set, where a specific differential algorithm may be multiple, for example, the differential algorithm may be one or more of Bsdiff, Xdelta3, and the like. The number and file types of the files included in the first file set and the second file set are not limited herein. 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, and the like.
The obtaining mode of the differential file may be determined according to an actual application scenario, for example, the differential file may be obtained by a terminal device executing the embodiment of the present application from another terminal through a specific information transmission mode, or obtained by the terminal device obtaining a first file set and a second file set according to a related request sent by another terminal after receiving the related request.
In step 102, it is detected 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.
In some embodiments, a provider (e.g., a developer) of the first compressed file may not provide compression information such as a specific compression parameter, a specific compression algorithm, and the like corresponding to the first compressed file. When the first file set is compressed after the first compressed file is decompressed, if there is a difference between the obtained new compressed file and the first compressed file, even if there is a difference of 1 bit, the new compressed file will be illegal when the new compressed file is verified by the digital signature of the first compressed file. Therefore, in the embodiment of the present application, a first compression parameter set may be obtained through detection, and the first file set is 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 may be used for verification of the third compressed file, so that it is not necessary for the provider of the first compressed file to re-provide the digital signature of the third compressed file, and processing efficiency is improved.
In this embodiment, the first compression parameter set may include one or more compression parameters, and in some embodiments, the first compression parameter set may further include one or more first compression parameter subsets, where each first compression parameter subset may respectively correspond to one file in the first file set, and the files corresponding to each first compression parameter subset are different from each other. Any of the first compression parameter subsets may be used to compress the corresponding file, and there may be a difference between each first compression parameter subset, and of course, the difference may also be the same. The compression parameters may be determined according to a specific compression algorithm, an application scenario, and the like.
In some embodiments, the first compression parameter set may include at least one of a parameter indicating a compression algorithm, a parameter indicating an encoding manner, a parameter indicating a degree of compression, and a parameter indicating a check field condition.
In the embodiment of the present application, the parameter may be in the form of preset numbers, characters, symbol numbers, and the like. The parameters may be independent of each other or may be related to each other. For example, since there may be differences between specific parameters corresponding to different compression algorithms, the parameters indicating different compression algorithms, the corresponding parameters indicating the encoding modes, and the parameters indicating the degree of compression may be different.
A specific example is illustrated below.
For example, in an application scenario, the detected compression algorithm is determined to be a Deflate compression algorithm, and then, when detecting whether the first set of compression parameters exists, a parameter indicating an encoding manner, a parameter indicating a degree of compression, and a parameter indicating a check field condition in the Deflate compression algorithm may be detected to determine whether the first set of compression parameters exists.
Wherein the detected compression algorithm is determined to be a Deflate compression algorithm, then the detected parameters may include stride, level, and nowrap when detecting whether the first set of compression parameters exists. Specifically, the parameter indicating the encoding mode may be named as "stripe", and a value of the stripe may be 0 to 4, where 0 represents normal data, 1 represents data generated by a filter (or referred to as a predictor), 2 represents forced huffman coding, 3 represents a constraint matching length of 1, and 4 represents that dynamic huffman coding is prevented from being used. The parameter for indicating the degree of compression may be named level, and the level may have three values, where 0 represents no compression, 1 represents a speed-first compression degree higher than 0, 9 represents a compression priority, the compression degree is higher than 1, and the compression speed is slower than 1. The parameter for indicating the case of the check field may be named as a nowrap, and the nowrap may indicate whether a check header of zlib is used, where the nowrap may have two values, 1 indicates that the zlib check header and the check field are not used, and 0 indicates that the zlib check header and the check field are used. The string, the level, and the nowrap may also represent other meanings by other values.
In step 103, if the first compression parameter set exists, a first digital signature of the first compressed file is obtained.
In this embodiment of the present application, if a first compression parameter set exists, the first file set may 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 may be used for verification of the third compressed file, so that the provider of the first compressed file may not be required to re-provide the digital signature of the third compressed file.
In this embodiment of the present application, generally, the first digital signature of the first compressed file is included in the first compressed file, and therefore, the first digital signature may be directly extracted from the first compressed file. Of course, the first digital signature of the first compressed file may also be generated according to a private key provided by a provider (e.g., developer) of the first compressed file.
In step 104, a first target compressed file is obtained comprising first compression parameter information, the difference file and the first digital signature, wherein the first compression parameter information comprises information on the first set of compression parameters.
In this embodiment, in the first target compressed file, there may be a plurality of existence forms of the first compression parameter information, the differential file, and the first digital signature. For example, a first file containing information of the first compression parameter set may be generated, a second file containing information of the first digital signature may be generated, and a target compressed file containing the difference 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 flag.
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.
In this embodiment of the application, the type of the designated terminal may be various, for example, the designated terminal may be a mobile phone, a tablet computer, a wearable device, an in-vehicle device, a server, an Augmented Reality (AR)/Virtual Reality (VR) device, a notebook computer, and the like.
The differential file is obtained by decompressing the first compressed file and the second compressed file, and at this time, the size of the first target compressed file is often smaller than the size of the file obtained by directly performing differential operation on the first compressed file and the second compressed file, so that in information transmission, the flow consumption of related users can be greatly reduced, and the transmission time is reduced.
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.
Specifically, in some embodiments, after the first target compressed file is sent to a designated terminal, a decompressed third file set of the fourth compressed file in the designated terminal may be obtained, and a differential file in the first target compressed file may be synthesized with the third file set, so that the designated terminal may obtain a restored first file set, and then obtain a restored first compressed file according to the first compression parameter information, so that the restored first compressed file may be verified by the first digital signature, and thus the designated terminal may use the first compressed file to perform a corresponding function, perform installation, reading, and the like.
As shown in fig. 2, optionally, in some embodiments, the file processing method may further include the following steps:
step 201, if the first compression parameter set does not exist, determining a second compression parameter set according to a compression speed, a compression rate and/or a compressed file similarity degree, wherein the compressed file similarity degree is a similarity degree between a fifth compressed file obtained by compressing the first file set according to the second compression parameter set and the first compressed file;
step 202, compressing the first file set according to the second compression parameter set to obtain a fifth compressed file;
step 203, acquiring a second digital signature of the fifth compressed file;
step 204, obtaining a second target compressed file containing second compression parameter information, the difference file and the second digital signature, wherein the second compression parameter information contains information of the second compression parameter set.
In the embodiment of the present application, the compression speed, the compression rate, and/or the degree of similarity of the compressed file may be regarded as an influence factor that influences the determination of the second compression parameter set, and the selection of the influence factor may be determined according to actual requirements. For example, it may be predetermined which one or more impact factors to determine the second compression parameter set, or it may be determined which one or more impact factors to determine the second compression parameter set according to at least one of the state information of the designated terminal and the information such as the size of the differential file, where the state information of the designated terminal may include the network connection condition of the designated terminal. For example, if the differential file is large, the second compression parameter set may be determined according to a compression rate.
In this 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 may be transmitted to a provider of the first compressed file, and a second digital signature of the provider on the fifth compressed file is acquired; alternatively, the second digital signature of the fifth compressed file is also generated from a private key provided by a provider (e.g., developer) of the first compressed file.
In some embodiments, the obtaining the digital signature of the fifth compressed file comprises:
and sending the fifth compressed file to a preset object, and receiving a second digital signature returned by the preset object, wherein the preset object is an object for setting a first digital signature of the first compressed file.
In this embodiment of the application, the preset object may be an object providing the first compressed file, and for example, may be a developer of the first compressed file. For example, after receiving the fifth compressed file, the preset object may generate the second digital signature by using a key used for generating the first digital signature, and return the second digital signature to a terminal device executing the embodiment of the present application.
In some embodiments, the obtaining the digital signature of the fifth compressed file comprises:
and generating a second digital signature of the fifth compressed file according to a preset key, wherein the preset key is received from the preset object in advance, and the preset key is used for generating the first digital signature.
In this embodiment of the present application, the preset key may be that the preset object is sent to the terminal device executing the embodiment of the present application in advance. At this time, the terminal device executing the embodiment of the present application may conveniently generate the second digital signature of the fifth compressed file.
Optionally, in some embodiments, the step S101 may include the following steps:
a1, after receiving a download request of a designated terminal to a first compressed file, acquiring historical version information of a fourth compressed file in the designated terminal;
a2, acquiring a second compressed file according to the historical version information;
a3, obtaining a first compressed file;
and A4, obtaining a differential file of the first file set and the second file set according to the first compressed file and the second compressed file.
The terminal device performing the embodiment may be a device (such as a server or a specific mobile terminal) capable of providing corresponding download resources. The historical version information may be information for identifying a version of a corresponding file, and may include, for example, a version number, a file name, and the like.
After receiving a download request of the designated terminal to the first compressed file, the object to be subjected to the difference operation can be determined by acquiring the historical version information in the designated terminal.
For example, in some application scenarios, it may be that the user needs to update the application program in the mobile terminal, so that a new version of the installation package (i.e., the first compressed file) of the application program needs to be obtained, while the mobile terminal may contain an old version of the installation package (i.e., the fourth compressed file), so that the mobile terminal may request the server through the application store to obtain the new version of the installation package. The server may obtain historical version information of the old version installation package in the designated terminal from the designated terminal, so that in the server, a file (i.e., a second compressed file) identical to the old version installation package in the mobile terminal and a new version installation package required by the mobile terminal are obtained, and the differential file is obtained according to the second compressed file and the first compressed file.
Optionally, in some embodiments, the detecting whether the first set of compression parameters exists includes:
for any first file in the first file set, detecting whether a first compression parameter exists, wherein the first compression parameter is used for compressing the first file to obtain a first compressed subfile, and the first compressed subfile has corresponding same parts in the first compressed file;
and traversing each first file in the first file set, and detecting whether each first file has a corresponding first compression parameter, wherein the first compression parameter set comprises each first compression parameter.
In this embodiment, a compressed portion corresponding to the first file may be determined in the first compressed file, and it may be detected whether the compressed portion is the same as the first compressed subfile of the first file. Of course, the first compressed subfile and the first compressed file may also be directly compared to determine that the first compressed subfile has the corresponding same portion in the first compressed file.
In some cases, because the types of the first files in the first file set may be different, and the compression modes for the files of different types may be different, the first compression parameter corresponding to each first file may be determined separately, so as to improve the accuracy of detection.
In some embodiments, said detecting whether a first compression parameter exists for any of the first set of files comprises:
determining at least two groups of compression parameters to be verified for any first file in the first file set;
and detecting whether a first compression parameter exists in the at least two groups of compression parameters to be verified in a parallel mode.
In the embodiment of the present application, the parallel manner may be implemented by different processing processes (or different threads). In general, the parameters included in the 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 a parameter for indicating a compression algorithm, a parameter for indicating an encoding manner, a parameter for indicating a degree of compression, and a parameter for indicating a check field condition. Because the detection of each group of compression parameters to be verified is independent, whether the first compression parameter exists in at least two groups of compression parameters to be verified can be detected in a parallel mode, and therefore the detection efficiency can be greatly improved.
The following describes an application of the embodiments of the present application in a specific application scenario by using a specific example.
Fig. 3 is a schematic flowchart of an implementation process of detecting whether a first compression parameter set exists according to the embodiment of the present application.
Wherein one first file in the first set of files comprises new file 1, new file 2, new file 3, and so on. For the new file 1, determining a plurality of groups of compression parameters to be verified corresponding to the new file 1. The compression parameters to be verified include stream, level and nowrap, where the parameter indicating the encoding mode may be named stream, and values of the stream may have values of 0 to 4, where 0 represents used for normal data, 1 represents used for data generated by a filter (or called predictor), 2 represents used for forced huffman encoding, 3 represents that a constraint matching length is 1, and 4 represents that the use of dynamic huffman encoding is prevented. The parameter for indicating the degree of compression may be named level, and the level may have three values, where 0 represents no compression, 1 represents a speed-first compression degree higher than 0, 9 represents a compression priority, the compression degree is higher than 1, and the compression speed is slower than 1. The parameter for indicating the case of the check field may be named as a nowrap, and the nowrap may indicate whether a check header of zlib is used, where the nowrap may have two values, 1 indicates that the zlib check header and the check field are not used, and 0 indicates that the zlib check header and the check field are used.
At this time, values of strategy, level and nowrap in each group of compression parameters to be verified can be respectively set and determined, since 5 types of strategy values are provided, 3 types of level values are provided, and 2 types of nowrap values are provided, the number of the compression parameters to be verified can be 5 × 3 × 2 — 30 types, and at this time, it can be detected through 30 threads that the corresponding same part of the compressed subfile to be verified obtained by compressing the first file through each group of compression parameters to be verified exists in the first compressed file; and if one compressed subfile to be verified has the corresponding same part in the first compressed file, the compression parameter to be verified corresponding to the compressed subfile to be verified is the first compression parameter of the first file.
In the same way, it can be used for the new file 2 and the new file 3 in the first file set, and so on. It should be noted that the compression parameters to be verified respectively corresponding to other files may be different from or the same as the new file 1. And are not limited herein.
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 the differential operation on the first compressed file and the second compressed file, therefore, in the subsequent information transmission, the traffic consumption of the relevant user can be greatly reduced, and the transmission time can be reduced. Furthermore, by detecting the first compression parameter set, a third compressed file identical to the first compressed file may be obtained; at this time, the digital signature of the first compressed file may be used for verifying the third compressed file, so that a provider of the first compressed file may not be required to provide the digital signature of the third compressed file again, the efficiency of information processing is improved, the time required for information processing is shortened, and the user experience is improved.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Example 2
An embodiment of the present application provides a file processing apparatus, where the file processing apparatus may be integrated in a terminal device, and as shown in fig. 4, the file processing apparatus 4 in the embodiment of the present application includes:
a first processing module 401, configured to obtain a differential file between a first file set and a second file set, where 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 history version file of the first compressed file;
a first detecting module 402, configured to detect 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;
a second processing module 403, configured to obtain a first digital signature of the first compressed file if the first compression parameter set exists;
a third processing module 404, configured to obtain a first target compressed file comprising first compression parameter information, the difference file and the first digital signature, wherein the first compression parameter information comprises information about the first compression parameter set.
A sending module 405, configured to send the first target compressed file to an appointed terminal, so as to instruct the appointed terminal to obtain a restored first compressed file according to the first target compressed file and a fourth compressed file in the appointed terminal, where the fourth compressed file is the same as the second compressed file.
Optionally, the document processing apparatus 4 further includes:
a first determining module, configured to determine a second compression parameter set according to a compression speed, a compression rate, and/or a degree of similarity of compressed files if the first compression parameter set does not exist, where the degree of similarity of the 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;
the fourth processing module is used for compressing the first file set according to the second compression parameter set to obtain a fifth compressed file;
the first acquisition module is used for acquiring a second digital signature of the fifth compressed file;
a fifth processing module, configured to obtain a second target compressed file including second compression parameter information, the differential file, and the second digital signature, where the second compression parameter information includes information of the second compression parameter set.
Optionally, the first obtaining module is specifically configured to:
and sending the fifth compressed file to a preset object, and receiving a second digital signature returned by the preset object, wherein the preset object is an object for setting a first digital signature of the first compressed file.
Optionally, the first obtaining module is specifically configured to:
and generating a second digital signature of the fifth compressed file according to a preset key, wherein the preset key is received from the preset object in advance, and the preset key is a key used for generating the first digital signature.
Optionally, the first processing module 401 specifically includes:
the device comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring historical version information of a fourth compressed file in a designated terminal after receiving a downloading request of the designated terminal to a first compressed file;
the second acquisition unit is used for acquiring a second compressed file according to the historical version information;
a third obtaining unit configured to obtain the first compressed file;
and the first processing unit is used for obtaining a differential file of the first file set and the second file set according to the first compressed file and the second compressed file.
Optionally, in this embodiment of the application, the first digital signature in the first target compressed file is used to verify the restored first compressed file after the restored first compressed file is obtained.
Optionally, in this embodiment of the application, the first compression parameter set includes at least one of a parameter for indicating a compression algorithm, a parameter for indicating an encoding manner, a parameter for indicating a degree of compression, and a parameter for indicating a condition of a check field.
Optionally, the first detecting module 402 specifically includes:
a first detecting unit, configured to detect whether a first compression parameter exists for any first file in the first file set, where the first compression parameter is used to compress the first file to obtain a first compressed subfile, and the first compressed subfile has a corresponding same portion in the first compressed file;
and a second detecting unit, configured to traverse each first file in the first file set, and detect whether each first file has a corresponding first compression parameter, where the first compression parameter set includes each first compression parameter.
Optionally, the first detecting unit specifically includes:
the determining subunit is configured to determine, for any first file in the first file set, at least two sets of compression parameters to be verified;
and the detection subunit is used for detecting whether the first compression parameter exists in the at least two groups of compression parameters to be verified in a parallel mode.
Therefore, according to the scheme of the application, the differential file is obtained after the first compressed file and the second compressed file are decompressed, and at the moment, the size of the first target compressed file is often smaller than that of the file obtained by directly carrying out differential operation on the first compressed file and the second compressed file, so that the flow consumption of related users can be greatly reduced in subsequent information transmission, and the transmission time is shortened. Furthermore, by detecting the first compression parameter set, a third compressed file identical to the first compressed file may be obtained; at this time, the digital signature of the first compressed file may be used for verifying the third compressed file, so that a provider of the first compressed file may not be required to provide the digital signature of the third compressed file again, the efficiency of information processing is improved, the time required for information processing is shortened, and the user experience is improved.
Example 3
An embodiment of the present application provides a terminal device, please refer to fig. 5, where the terminal device in the embodiment of the present application includes: a memory 501, one or more processors 502 (only one shown in fig. 5), and a computer program stored on the memory 501 and executable on the processors. Wherein: the memory 501 is used for storing 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, so as to acquire resources corresponding to the preset events. Specifically, the processor 502 realizes the steps in any of the above-described file processing method embodiments by executing the above-described computer program stored in the memory 501.
Further, as shown in fig. 5, the terminal device may further include: one or more input devices 503 (only one shown in fig. 5) and one or more output devices 504 (only one shown in fig. 5). The memory 501, processor 502, input device 503, and output device 504 are connected by a bus 505.
It should be understood that in the embodiments of the present Application, the Processor 502 may be a Central Processing Unit (CPU), and the Processor may be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The input device 503 may include a keyboard, a touch pad, a fingerprint sensor (for collecting fingerprint information of a user and direction information of the fingerprint), a microphone, etc., and the output device 504 may include a display, a speaker, etc.
Memory 501 may include both read-only memory and random access memory and provides instructions and data to processor 502. Some or all of the memory 501 may also include non-volatile random access memory. For example, the memory 501 may also store device type information.
Therefore, according to the scheme of the application, the differential file is obtained after the first compressed file and the second compressed file are decompressed, and at the moment, the size of the first target compressed file is often smaller than that of the file obtained by directly carrying out differential operation on the first compressed file and the second compressed file, so that the flow consumption of related users can be greatly reduced in subsequent information transmission, and the transmission time is shortened. Furthermore, by detecting the first compression parameter set, a third compressed file identical to the first compressed file may be obtained; at this time, the digital signature of the first compressed file may be used for verifying the third compressed file, so that a provider of the first compressed file may not be required to provide the digital signature of the third compressed file again, the efficiency of information processing is improved, the time required for information processing is shortened, and the user experience is improved.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned functions may be distributed as different functional units and modules according to needs, that is, the internal structure of the apparatus may be divided into different functional units or modules to implement all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art would appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of external device software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described system embodiments are merely illustrative, and for example, the division of the above-described modules or units is only one logical functional division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The integrated unit may be stored in a computer-readable storage medium if it is implemented in the form of a software functional unit and sold or used as a separate product. Based on such understanding, all or part of the flow in the method of the embodiments described above may be implemented by a computer program, which may be stored in a computer readable storage medium and used by a processor to implement the steps of the embodiments of the methods described above. The computer program includes computer program code, and the computer program code may be in a source code form, an object code form, an executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying the above-described computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer readable Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable storage medium may contain other contents which can be appropriately increased or decreased according to the requirements of the legislation and the patent practice in the jurisdiction, for example, in some jurisdictions, the computer readable storage medium does not include an electrical carrier signal and a telecommunication signal according to the legislation and the patent practice.
The embodiment of the present application provides a computer program product, which when running on a mobile terminal, enables the mobile terminal to implement the steps in the foregoing file processing method embodiments when executed.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (20)

  1. A file processing method, comprising:
    obtaining a differential file of 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 history version file of the first compressed file;
    detecting whether a first compression parameter set exists or not, wherein the first compression parameter set is used for compressing 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, acquiring a first digital signature of the first compressed file;
    obtaining a first target compressed file comprising first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information comprises information about the first set of compression parameters;
    and 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.
  2. The document processing method according to claim 1, further comprising:
    if the first compression parameter set does not exist, determining a second compression parameter set according to the compression speed, the compression rate and/or the similarity degree of the compressed files, wherein the similarity degree of the compressed files is the similarity degree of 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;
    acquiring a second digital signature of the fifth compressed file;
    and obtaining a second target compressed file containing second compression parameter information, the difference file and the second digital signature, wherein the second compression parameter information contains information of the second compression parameter set.
  3. The file processing method according to claim 2, wherein said obtaining a digital signature of the fifth compressed file comprises:
    and sending the fifth compressed file to a preset object, and receiving a second digital signature returned by the preset object, wherein the preset object is an object for setting a first digital signature of the first compressed file.
  4. The file processing method according to claim 2, wherein said obtaining a digital signature of the fifth compressed file comprises:
    and generating a second digital signature of the fifth compressed file according to a preset key, wherein the preset key is received from the preset object in advance, and the preset key is used for generating the first digital signature.
  5. The file processing method of claim 1, wherein the obtaining a differential file of the first set of files and the second set of files comprises:
    after a downloading request of a designated terminal to a first compressed file is received, acquiring historical version information of a fourth compressed file in the designated terminal;
    acquiring a second compressed file according to the historical version information;
    acquiring a first compressed file;
    and obtaining a differential file of the first file set and the second file set according to the first compressed file and the second compressed file.
  6. The file processing method of claim 1, wherein 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.
  7. The file processing method according to claim 1, wherein the first compression parameter set includes at least one of a parameter for indicating a compression algorithm, a parameter for indicating an encoding manner, a parameter for indicating a degree of compression, and a parameter for indicating a check field condition.
  8. The file processing method according to any one of claims 1 to 7, wherein the detecting whether the first set of compression parameters exists comprises:
    for any first file in the first file set, detecting whether a first compression parameter exists, wherein the first compression parameter is used for compressing the first file to obtain a first compressed subfile, and the first compressed subfile has corresponding same parts in the first compressed file;
    and traversing each first file in the first file set, and detecting whether each first file has a corresponding first compression parameter, wherein the first compression parameter set comprises each first compression parameter.
  9. The file processing method according to claim 8, wherein said detecting whether there is a first compression parameter for any first file in said first set of files comprises:
    determining at least two groups of compression parameters to be verified for any first file in the first file set;
    and detecting whether a first compression parameter exists in the at least two groups of compression parameters to be verified in a parallel mode.
  10. A document processing apparatus, characterized by comprising:
    the system comprises a first processing module, a second processing module and a third processing module, wherein the first processing module is used for obtaining a differential file of a first file set and a second file set, 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;
    the first detection module is used for detecting whether a first compression parameter set exists or not, the first compression parameter set is used for compressing the first file set, and a third compressed file obtained by compression is the same as the first compressed file;
    the second processing module is used for acquiring a first digital signature of the first compressed file if the first compressed parameter set exists;
    a third processing module to obtain a first target compressed file comprising first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information comprises information about the first set of compression parameters.
    And the sending module is used for sending 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.
  11. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
    obtaining a differential file of 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 history version file of the first compressed file;
    detecting whether a first compression parameter set exists or not, wherein the first compression parameter set is used for compressing 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, acquiring a first digital signature of the first compressed file;
    obtaining a first target compressed file comprising first compression parameter information, the difference file, and the first digital signature, wherein the first compression parameter information comprises information about the first set of compression parameters;
    and 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.
  12. The terminal device of claim 11, wherein the processor, when executing the computer program, further performs the steps of:
    if the first compression parameter set does not exist, determining a second compression parameter set according to the compression speed, the compression rate and/or the similarity degree of the compressed files, wherein the similarity degree of the compressed files is the similarity degree of 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;
    acquiring a second digital signature of the fifth compressed file;
    and obtaining a second target compressed file containing second compression parameter information, the difference file and the second digital signature, wherein the second compression parameter information contains information of the second compression parameter set.
  13. The terminal device of claim 12, wherein the processor, when executing the computer program, obtaining the digital signature of the fifth compressed file comprises:
    and sending the fifth compressed file to a preset object, and receiving a second digital signature returned by the preset object, wherein the preset object is an object for setting a first digital signature of the first compressed file.
  14. The terminal device of claim 12, wherein the processor, when executing the computer program, obtaining the digital signature of the fifth compressed file comprises:
    and generating a second digital signature of the fifth compressed file according to a preset key, wherein the preset key is received from the preset object in advance, and the preset key is used for generating the first digital signature.
  15. The terminal device of claim 11, wherein the processor, when executing the computer program, obtaining a differential file of the first set of files and the second set of files comprises:
    after a downloading request of a designated terminal to a first compressed file is received, acquiring historical version information of a fourth compressed file in the designated terminal;
    acquiring a second compressed file according to the historical version information;
    acquiring a first compressed file;
    and obtaining a differential file of the first file set and the second file set according to the first compressed file and the second compressed file.
  16. The terminal device of claim 11, wherein the processor, when executing the computer program, is configured to verify the restored first compressed file after obtaining the restored first compressed file.
  17. The terminal device of claim 11, wherein the processor, when executing the computer program, the first set of compression parameters comprises at least one of a parameter indicating a compression algorithm, a parameter indicating a coding scheme, a parameter indicating a degree of compression, and a parameter indicating a check field condition.
  18. The terminal device according to any of claims 11 to 17, wherein the processor, when executing the computer program, detecting whether a first set of compression parameters is present comprises:
    for any first file in the first file set, detecting whether a first compression parameter exists, wherein the first compression parameter is used for compressing the first file to obtain a first compressed subfile, and the first compressed subfile has corresponding same parts in the first compressed file;
    and traversing each first file in the first file set, and detecting whether each first file has a corresponding first compression parameter, wherein the first compression parameter set comprises each first compression parameter.
  19. The terminal device of claim 18, wherein the processor, when executing the computer program, detecting whether a first compression parameter exists for any of the first set of files comprises:
    determining at least two groups of compression parameters to be verified for any first file in the first file set;
    and detecting whether a first compression parameter exists in the at least two groups of compression parameters to be verified in a parallel mode.
  20. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the file processing method according to any one of claims 1 to 9.
CN201980100491.8A 2019-11-18 2019-11-18 File processing method, file processing device and terminal equipment Pending CN114402286A (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/119243 WO2021097624A1 (en) 2019-11-18 2019-11-18 File processing method, file processing apparatus, and terminal device

Publications (1)

Publication Number Publication Date
CN114402286A true CN114402286A (en) 2022-04-26

Family

ID=75981116

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201980100491.8A Pending CN114402286A (en) 2019-11-18 2019-11-18 File processing method, file processing device and terminal equipment

Country Status (2)

Country Link
CN (1) CN114402286A (en)
WO (1) WO2021097624A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116781791A (en) * 2022-03-11 2023-09-19 华为技术有限公司 Information processing method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101356519B (en) * 2006-06-19 2011-11-09 三星电子株式会社 Program upgrade system and method for ota-capable portable device
CN102724308A (en) * 2012-06-13 2012-10-10 腾讯科技(深圳)有限公司 Software update method and software update system
CN103713928B (en) * 2013-12-31 2017-02-22 优视科技有限公司 Incremental file generating method, and application program installing file updating method and device
CN104391728B (en) * 2014-12-12 2018-01-16 北京奇虎科技有限公司 Software upgrading difference packet acquisition methods and corresponding upgrade method and device
CN105138347A (en) * 2015-07-17 2015-12-09 广东欧珀移动通信有限公司 Difference upgrade patch generating method, software upgrading method and corresponding apparatus

Also Published As

Publication number Publication date
WO2021097624A1 (en) 2021-05-27

Similar Documents

Publication Publication Date Title
CN109814524B (en) Vehicle diagnosis method, device and system
CN105389177A (en) Software version confirmation method, device and system
CN111694589B (en) Upgrade package generation method, device, server and computer readable storage medium
CN106055375B (en) Application program installation method and device
CN111857550A (en) Method, apparatus and computer readable medium for data deduplication
CN115269038B (en) Stateless computing data processing method, program product and electronic device
CN111782660A (en) Data compression method and system based on key value storage
CN112286565B (en) Embedded system differential upgrading method based on storage container
CN112947981A (en) Application program resource updating method and device, terminal equipment and server
CN114465998A (en) Multi-device file transmission method and device, terminal device and readable storage medium
CN107239309A (en) Patch generation method and device, update method, electronic equipment, storage medium
CN111176685A (en) Upgrading method and device
CN114402286A (en) File processing method, file processing device and terminal equipment
CN111273939B (en) Information processing method, information processing device and terminal equipment
CN112445769A (en) Block chain-based on-chain storage method and device, terminal equipment and medium
CN110505289B (en) File downloading method and device, computer readable medium and wireless communication equipment
CN111026926A (en) Data processing method, device, equipment and storage medium
CN110930253A (en) Intelligent contract internal main key generation method and device, computer equipment and storage medium
CN114303131A (en) File processing method, file processing device and terminal equipment
CN111162792A (en) Compression method and device for power load data
CN109002710B (en) Detection method, detection device and computer readable storage medium
CN111324645A (en) Data processing method and device for block chain
CN114365081A (en) Incremental package generation method, incremental package generation device and server
CN114402311A (en) Incremental updating method and device of file, terminal and computer-readable storage medium
CN110955464A (en) Service processing method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination