File packaging and unpackaging methods, apparatuses, and network devices
At least one to-be-packaged file is obtained. A to-be-packaged file of the at least one to-be-packaged file is compressed to generate a compressed file. A storage location identifier is generated, based on a security level of the to-be-packaged file, where the storage location identifier indicates a storage location of a decompressed file obtained after decompression of the compressed file, and where the storage location includes a memory or a local disk. The compressed file and additional information comprising the storage location identifier are packaged to obtain a file package.
1. A computer-implemented method for file packaging, comprising:
obtaining, by a server, at least one to-be-packaged file;
generating, by the server, a compressed file by compressing a to-be-packaged file of the at least one to-be-packaged file;
generating, by the server, a storage location identifier based on a security level of the to-be-packaged file,
wherein the storage location identifier indicates a storage location of a decompressed file in a terminal device, wherein the decompressed file is obtained after decompression of the compressed file by the terminal device,
wherein the security level of the to-be-packaged file is high when the to-be-packaged file comprises a resource configuration file or a script file, wherein the security level of the to-be-packaged file is low when the to-be-packaged file comprises a video file or an image file,
and wherein the storage location is in a memory in the terminal device when the security level is high, and wherein the storage location is in a local disk in the terminal device when the security level is low; and
generating, by the server, a file package, wherein the file package comprises the compressed file and additional information, and wherein the additional information comprises the storage location identifier.
2. The computer-implemented method of claim 1 , wherein the additional information further comprises an encrypted file name corresponding to a file name of the decompressed file when the storage location of the decompressed file is in the local disk in the terminal device.
3. The computer-implemented method of claim 2 , wherein the encrypted file name is generated using an irreversible encryption algorithm.
4. The computer-implemented method of claim 1 , wherein the security level is determined based on at least one of a file extension or a file size of the to-be-packaged file.
5. The computer-implemented method of claim 1 , wherein the generating a file package comprises:
generating, by the server, a file package by of appending the compressed file after the additional information.
6. A non-transitory, computer-readable medium storing one or more instructions executable by a computer system to perform operations comprising:
obtaining, by a server, at least one to-be-packaged file;
generating, by the server, a compressed file by compressing a to-be-packaged file of the at least one to-be-packaged file;
generating, by the server, a storage location identifier based on a security level of the to-be-packaged file,
wherein the storage location identifier indicates a storage location of a decompressed file in a terminal device, wherein the decompressed file is obtained after decompression of the compressed file by the terminal device,
wherein the security level of the to-be-packaged file is high when the to-be-packaged file comprises a resource configuration file or a script file, wherein the security level of the to-be-packaged file is low when the to-be-packaged file comprises a video file or an image file,
and wherein the storage location is in a memory in the terminal device when the security level is high, and wherein the storage location is in a local disk in the terminal device when the security level is low; and
generating, by the server, a file package, wherein the file package comprises the compressed file and additional information, and wherein the additional information comprises the storage location identifier.
7. The non-transitory, computer-readable medium of claim 6 , wherein the additional information further comprises an encrypted file name corresponding to a file name of the decompressed file when the storage location of the decompressed file is in the local disk in the terminal device.
8. The non-transitory, computer-readable medium of claim 7 , wherein the encrypted file name is generated using an irreversible encryption algorithm.
9. The non-transitory, computer-readable medium of claim 6 , wherein the security level is determined based on at least one of a file extension or a file size of the to-be-packaged file.
10. The non-transitory, computer-readable medium of claim 6 , wherein the generating a file package comprises:
generating, by the server, a file package by appending the compressed file after the additional information.
11. A computer-implemented system, comprising:
one or more computers; and
one or more computer memory devices interoperably coupled with the one or more computers and having tangible, non-transitory, machine-readable media storing one or more instructions that, when executed by the one or more computers, perform one or more operations comprising:
obtaining, by a server, at least one to-be-packaged file;
generating, by the server, a compressed file by compressing a to-be-packaged file of the at least one to-be-packaged file;
generating, by the server, a storage location identifier based on a security level of the to-be-packaged file,
wherein the storage location identifier indicates a storage location of a decompressed file in a terminal device, wherein the decompressed file is obtained after decompression of the compressed file by the terminal device,
wherein the security level of the to-be-packaged file is high when the to-be-packaged file comprises a resource configuration file or a script file, wherein the security level of the to-be-packaged file is low when the to-be-packaged file comprises a video file or an image file,
and wherein the storage location is in a memory in the terminal device when the security level is high, and wherein the storage location is in a local disk in the terminal device when the security level is low; and
generating, by the server, a file package, wherein the file package comprises the compressed file and additional information, and wherein the additional information comprises the storage location identifier.
12. The computer-implemented system of claim 11 , wherein the additional information further comprises an encrypted file name corresponding to a file name of the decompressed file when the storage location of the decompressed file is in the local disk in the terminal device.
13. The computer-implemented system of claim 12 , wherein the encrypted file name is generated using an irreversible encryption algorithm.
14. The computer-implemented system of claim 11 , wherein the security level is determined based on at least one of a file extension or a file size of the to-be-packaged file.
15. The computer-implemented system of claim 11 , wherein the generating a file package comprises:
generating, by the server, a file package by appending the compressed file after the additional information.