Method and device for decompressing compressed file
By compiling and running decompression code supporting the applet in the applet, and directly decompressing the compressed files on the applet end, the problems of low decompression efficiency and security in the existing technology are solved, and efficient and secure file decompression is achieved, and multiple support for These compression formats and decompression in the compression package.
Patent Information
- Application Number
- CN202310809851.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-03
- Publication Date
- 2025-01-03
AI Technical Summary
In the prior art, the efficiency and security of compressed files are low, and files need to be uploaded to the server for decompression, which increases network transmission time and server pressure, and poses the risk of data leakage and file corruption.
By obtaining the first code that does not support running on the applet, compiling it into a second code that supports running the applet, directly running the second code in the applet to decompress the compressed file, avoiding file upload and download, and using WebAssembly technology to achieve Cross-platform compatibility and high-performance decompression.
Improves the efficiency and security of file decompression, reduces network transmission time, reduces server pressure, and avoids data leakage and file corruption. It supports multiple compression formats and compressed packet decompression in compressed packets.
Smart Images

Figure CN119248272A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for decompressing a compressed file. Background Art
[0002] In the prior art, to decompress a compressed file, the compressed file to be decompressed usually needs to be sent to a server, and the server runs a decompression code to decompress the compressed file. After the decompression is completed, the terminal downloads the decompressed file from the server for use by the user.
[0003] However, in the above decompression method, the efficiency and security of file decompression are low. Summary of the invention
[0004] In view of this, in order to solve some or all of the above technical problems, an embodiment of the present application provides a method and device for decompressing a compressed file.
[0005] In a first aspect, an embodiment of the present application provides a method for decompressing a compressed file, the method comprising:
[0006] Obtain a first code, wherein at least a portion of the first code does not support running on a mini-program, and the first code is used to decompress the compressed file;
[0007] Compiling the first code into a second code, wherein the second code supports running on the applet;
[0008] Obtaining the compressed file;
[0009] The second code is run in the applet to decompress the compressed file.
[0010] In a possible implementation manner, running the second code in the applet to decompress the compressed file includes:
[0011] The compressed file is determined as a target file, and the following decompression steps are performed: the second code is run in the applet to decompress the target file; whether the decompressed file obtained by decompression includes the compressed file; if the decompressed file does not include the compressed file, determining that the decompression is completed;
[0012] In the case that the compressed file is included in the decompressed file, the compressed file in the decompressed file is determined as a target file; and the decompression step is performed based on the determined target file.
[0013] In a possible implementation, decompressing the target file includes:
[0014] Storing the target file in a memory to decompress the target file through the memory;
[0015] After the target file is decompressed through the memory, the target file is transferred to the stack, and the memory used to store the target file is reclaimed.
[0016] In a possible implementation, obtaining the compressed file includes:
[0017] Obtaining a binary data stream of the compressed file;
[0018] Convert the binary data stream into an object of a preset array type;
[0019] storing the object in memory; and
[0020] The step of running the second code in the applet to decompress the target file comprises:
[0021] The second code is run in the applet to read the object corresponding to the compressed file in the memory to decompress the target file.
[0022] In a possible implementation manner, compiling the first code into a second code includes:
[0023] Using a target compilation option, compile the first code into a second code;
[0024] The target compilation option is used to perform at least one of the following operations: setting compilation speed, controlling shared buffer, and controlling memory consumption.
[0025] In a possible implementation manner, after running the second code in the applet to decompress the compressed file, the method further includes:
[0026] Store the decompressed files in the cloud.
[0027] In a possible implementation, after storing the decompressed file in the cloud, the method further includes:
[0028] detecting a viewing operation performed on the decompressed file;
[0029] When the viewing operation is detected, the decompressed file stored locally is displayed, or the decompressed file stored in the cloud is displayed.
[0030] In one possible implementation, a node of a file tree is used to represent first file data of a file in the compressed file; each first file data is associated with second file data of a corresponding file in the compressed file, the first file data is stored in a memory, and the first file data is a file identifier; the second file data is obtained by decompression, and the second file data is stored in a stack.
[0031] In a second aspect, an embodiment of the present application provides a device for decompressing a compressed file, the device comprising:
[0032] A first acquisition unit is used to acquire a first code, wherein at least a part of the first code does not support running on the applet, and the first code is used to decompress the compressed file;
[0033] A compiling unit, configured to compile the first code into a second code, wherein the second code supports running on the applet;
[0034] A second obtaining unit, used to obtain the compressed file;
[0035] A decompression unit is used to run the second code in the applet to decompress the compressed file.
[0036] In a possible implementation manner, running the second code in the applet to decompress the compressed file includes:
[0037] The compressed file is determined as a target file, and the following decompression steps are performed: the second code is run in the applet to decompress the target file; whether the decompressed file obtained by decompression includes the compressed file; if the decompressed file does not include the compressed file, determining that the decompression is completed;
[0038] In the case that the compressed file is included in the decompressed file, the compressed file in the decompressed file is determined as a target file; and the decompression step is performed based on the determined target file.
[0039] In a possible implementation, decompressing the target file includes:
[0040] Storing the target file in a memory to decompress the target file through the memory;
[0041] After the target file is decompressed through the memory, the target file is transferred to the stack, and the memory used to store the target file is reclaimed.
[0042] In a possible implementation, obtaining the compressed file includes:
[0043] Obtaining a binary data stream of the compressed file;
[0044] Convert the binary data stream into an object of a preset array type;
[0045] storing the object in memory; and
[0046] The step of running the second code in the applet to decompress the target file comprises:
[0047] The second code is run in the applet to read the object corresponding to the compressed file in the memory to decompress the target file.
[0048] In a possible implementation manner, compiling the first code into a second code includes:
[0049] Using a target compilation option, compile the first code into a second code;
[0050] The target compilation option is used to perform at least one of the following operations: setting compilation speed, controlling shared buffer, and controlling memory consumption.
[0051] In a possible implementation manner, after the second code is executed in the applet to decompress the compressed file, the device further includes:
[0052] The storage unit is used to store the decompressed files in the cloud.
[0053] In a possible implementation manner, after storing the decompressed file in the cloud, the device further includes:
[0054] a detection unit, configured to detect a viewing operation performed on the decompressed file;
[0055] The display unit is used to display the decompressed file stored locally or the decompressed file stored in the cloud when the viewing operation is detected.
[0056] In one possible implementation, a node of a file tree is used to represent first file data of a file in the compressed file; each first file data is associated with second file data of a corresponding file in the compressed file, the first file data is stored in a memory, and the first file data is a file identifier; the second file data is obtained by decompression, and the second file data is stored in a stack.
[0057] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0058] Memory for storing computer programs;
[0059] The processor is used to execute the computer program stored in the memory, and when the computer program is executed, the method of any embodiment of the method for decompressing a compressed file in the first aspect of the present application is implemented.
[0060] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method of any embodiment of the method for decompressing a compressed file of the first aspect described above is implemented.
[0061] In a fifth aspect, an embodiment of the present application provides a computer program, which includes a computer-readable code. When the computer-readable code is executed on a device, the processor in the device implements a method as in any embodiment of the method for decompressing a compressed file of the first aspect described above.
[0062] The method for decompressing a compressed file provided in an embodiment of the present application can obtain a first code, wherein the first code at least partially does not support running on a mini-program, and the first code is used to decompress the compressed file, and then the first code is compiled into a second code, wherein the second code supports running on the mini-program, and then the compressed file is obtained, and then the second code is run in the mini-program to decompress the compressed file. As a result, the code for decompressing the compressed file can be run on the front end of the mini-program without uploading and downloading files, which reduces the time of network transmission and relieves the pressure on the back-end server. In addition, it can also avoid problems such as data leakage and file damage in sensitive file transmission, thereby improving the efficiency and security of file decompression. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present method and, together with the description, serve to explain the principles of the present method.
[0064] In order to more clearly illustrate the embodiments of the present method or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0065] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0066] Figure 1A flowchart of a method for decompressing a compressed file provided in an embodiment of the present application;
[0067] Figure 2 A flowchart of another method for decompressing a compressed file provided in an embodiment of the present application;
[0068] Figure 3 A flowchart of another method for decompressing a compressed file provided in an embodiment of the present application;
[0069] Figure 4 A schematic diagram of the structure of a compressed file decompression device provided in an embodiment of the present application;
[0070] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0071] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. It should be noted that unless otherwise specifically stated, the relative arrangement of the components and steps, the numerical expressions and the numerical values described in these embodiments do not limit the scope of the present application.
[0072] Those skilled in the art will understand that the terms "first" and "second" in the embodiments of the present application are only used to distinguish between different steps, devices, modules and other objects, and do not represent any specific technical meanings, nor do they indicate the logical order between them.
[0073] It should also be understood that in this embodiment, “plurality” may refer to two or more than two, and “at least one” may refer to one, two or more than two.
[0074] It should also be understood that any component, data or structure mentioned in the embodiments of the present application can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.
[0075] In addition, the term "and / or" in this application is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this application generally indicates that the associated objects before and after are in an "or" relationship.
[0076] It should also be understood that the description of the various embodiments in this application focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.
[0077] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present application, its application, or uses.
[0078] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the above-mentioned technologies, methods, and equipment should be considered as part of the specification.
[0079] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0080] It should be noted that, in the absence of conflict, the embodiments in this application and the features in the embodiments can be combined with each other. To facilitate the understanding of the embodiments of the present application, the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0081] In order to solve the technical problem of low efficiency and security of file decompression in the prior art, the present application provides a method for decompressing compressed files, which can improve the efficiency and security of file decompression.
[0082] Figure 1 A schematic flow chart of a method for decompressing a compressed file provided in an embodiment of the present application. The method can be applied to one or more electronic devices such as smart phones, laptops, desktop computers, portable computers, servers, etc. In addition, the execution subject of the method can be hardware or software. When the above-mentioned execution subject is hardware, the execution subject can be one or more of the above-mentioned electronic devices. For example, a single electronic device can execute the method, or a plurality of electronic devices can cooperate with each other to execute the method. When the above-mentioned execution subject is software, the method can be implemented as multiple software or software modules, or as a single software or software module. For example, the above-mentioned execution subject, as software, can be included in the application code of the applet. It is not specifically limited here.
[0083] like Figure 1 As shown, the method specifically includes:
[0084] Step 101: Obtain a first code, wherein at least a portion of the first code does not support running on a mini-program, and the first code is used to decompress the compressed file.
[0085] In this embodiment, the first code may include one or more codes that are not supported to run on the applet. As an example, the first code may include at least one of the following codes: C++ code, Rust code, etc.
[0086] In addition, in some cases, the first code may also include code that supports running on the applet. In other words, in this case, part of the code in the first code supports running on the applet, and another part of the code does not support running on the applet.
[0087] The first code may be used to implement the following functions: first, obtain the data of the compressed file, then decompress the compressed file, and then output the file list.
[0088] Mini Programs are applications that can be used without downloading and installing. Usually, Mini Programs need to rely on host applications to run. For example, users can run the Mini Program through the Mini Program entrance in the host application. During the operation of the Mini Program, the host application can provide a host environment for the Mini Program.
[0089] In some cases, the mini program may include files in the following formats: a JSON configuration file with a .json suffix, a WXML template file with a .wxml suffix, a WXSS style file with a .wxss suffix, and a JS script logic file with a .js suffix.
[0090] Step 102: compile the first code into a second code, wherein the second code supports running on the applet.
[0091] In this embodiment, a compiler may be used to compile the first code to obtain the second code.
[0092] The compiler may be a computer program that converts source code (ie, the first code) into an executable program (ie, the second code).
[0093] Among them, the second code is the code that supports running on the mini program.
[0094] As an example, in the case of using WebAssembly technology, the format of the second code may be a WebAssembly binary format. The second code may include at least one of the following: a wasm file, and a JS (JavaScript) code corresponding to the wasm file.
[0095] Among them, WebAssembly (WASM) is a bytecode format that can run in the environment of the front-end (Web) browser or in an environment other than the front-end (Web) browser, and can work on multiple platforms. Based on WebAssembly (WASM), high-performance applications can also be applied to the environment of the front-end (Web) browser.
[0096] Specifically, the following method can be used to load and run WebAssembly code: use Emscripten to compile the code developed in high-level languages such as C / C++ / Rust / Java (corresponding to the first code mentioned above) or function library into a wasm file (corresponding to the second code mentioned above), so that it can be combined with the WebAssembly JS API (Application Programming Interface) to run in a browser environment.
[0097] When the browser is running, you can use the following steps to call the wasm file through JS code:
[0098] 1. Load the bytecode of the wasm file.
[0099] 2. Convert the acquired bytecode into ArrayBuffer. This structure can be compiled correctly. The above ArrayBuffer can be verified during compilation, and compilation can be performed only after verification. After compilation, a resolved Promise object can be returned through Promise resolve. Among them, Promise resolve is a WebAssembly.Module object (compiled WebAssembly module).
[0100] 3. After obtaining the module, you can use the WebAssembly.Instance API to synchronously instantiate the module.
[0101] 4. The above steps 2 and 3 can also be replaced by the instantiate asynchronous API.
[0102] 5. After that, you can call it just like using a JS code module.
[0103] In some optional implementations of this embodiment, a target compilation option may be used to compile the first code into a second code.
[0104] The target compilation option is used to perform at least one of the following operations: setting compilation speed, controlling shared buffer, and controlling memory consumption.
[0105] Specifically, the target compilation option may include at least one of the following: a “-O3” compilation option, a “-s USE_PTHREADS=0” compilation option, and a “-s ALLOW_MEMORY_GROWTH=1” compilation option.
[0106] Among them, through the "-O3" compilation option, the compilation speed can be set, for example, the compilation speed can be increased; through the "-sUSE_PTHREADS=0" compilation option, the problem that the iOS Safari browser is incompatible with the SharedArrayBuffer shared buffer can be solved, thereby controlling the shared buffer and ensuring that the compiled second code can be compatible with various system platforms; through the "-sALLOW_MEMORY_GROWTH=1" compilation option, it can support increasing memory allocation when memory exhaustion is detected, thereby solving the OOM (Out Of Memory) problem that occurs when decoding extremely large compressed packages, and then controlling memory consumption.
[0107] It should be noted that, in addition to the target compilation options listed above, other compilation options can also be used in practice to achieve the same function. For example, developers can design their own compilers and the compilation options required for use in the compilation process. The above is only an exemplary description of the target compilation options and does not constitute a limitation on the above optional implementation methods.
[0108] It can be understood that in the above optional implementation, in the process of compiling the first code into wasm bytecode and glue JS code, the compilation speed, shared buffer and memory consumption can be set through the target compilation option.
[0109] In some optional implementations of this embodiment, in the scenario where the second code is glue JS code, due to compatibility issues in some mini-program environments, the SDL-related code added during libwebp compilation in the compiled glue JS code can also be removed to save memory space.
[0110] Among them, libwebp is a library for parsing and decoding webp format images. Among them, webp is a picture format. Parser refers to the process of converting a certain format of text (string) into a certain data structure.
[0111] In some optional implementations of this embodiment, the code not used by the applet can also be removed from the second code. For example, in the scenario where the second code includes glue JS code, the code not used by the applet in the glue JS code, such as ENVIRONMENT_IS_NODE / ENVIRONMENT_IS_SHELL related code, can also be removed.
[0112] In some optional implementations of this embodiment, the streaming compilation and instantiation methods in the second code may be removed and replaced with non-streaming compilation and instantiation methods to solve compatibility issues with browsers such as iOS Safari.
[0113] In some optional implementations of this embodiment, the error code in the second code can also be deleted or adjusted. For example, when the second code is glue JS code, the new WebAssembly.Memory code will report an error of "refused to create a webassembly object without'unsafe-eval'" when running in some applet environments. At this time, it can be solved by adding unsafe-eval to the CSP (Content-Security-Policy) settings in page-frame.html.
[0114] In some optional implementations of this embodiment, the code in the second code that is not supported by the mini program can be replaced with the code that is supported by the mini program. For example, some mini programs ios do not support function codes such as export, Global, and newFunction, but support function, memory, and table. Therefore, the second code can be adjusted.
[0115] It should be noted that after adjusting the second code (including adding, deleting, replacing, etc.), an updated second code can be obtained, and subsequent steps need to be performed based on the updated second code.
[0116] For example, by calling the 2nd and 3rd steps of wasm through the above glue JS code, the glue JS code (corresponding to the above second code) can be compiled and generated. After adjusting the glue JS code, the adjusted glue JS code can be further run. Among them, adjusting the glue JS code can include at least one of the following: removing the SDL related code added during the compilation of libwebp in the compiled glue JS code, removing the code not used by the applet, removing the streaming compilation and instantiation methods, deleting or adjusting the error code in the glue JS code, and replacing the code that the applet does not support in the code with the code supported by the applet.
[0117] Step 103: Obtain the compressed file.
[0118] In this embodiment, the compressed file may include a file in at least one of the following formats: RAR, 7z, ZIP, etc. In addition, the compressed file is a file obtained by compressing the original file, and may be one or more files. In the case where the original file corresponding to the compressed file includes multiple files, the files included in the original file may be compressed files or uncompressed files.
[0119] Among them, RAR is a data compression format that can be used on multiple platforms. 7z is an efficient compression algorithm and file format that provides a better compression ratio than other compression formats. ZIP is an archive file format that can be used on multiple platforms.
[0120] Here, the JS code of the applet may be used to execute the above step 103 so as to obtain the compressed file.
[0121] In some optional implementations of this embodiment, the following method may be used to obtain the compressed file:
[0122] First, the binary data stream of the compressed file is obtained.
[0123] Afterwards, the binary data stream is converted into an object of a preset array type.
[0124] The preset array type may be a predetermined array type. The preset array type may be used to store the relevant data of the compressed file in the memory. For example, the preset array type may be a Uint8Array (8-bit unsigned integer array) type.
[0125] The object is then stored in memory.
[0126] On this basis, the following method can be adopted to run the second code in the applet to decompress the target file: run the second code in the applet, read the object corresponding to the compressed file in the memory, and decompress the target file.
[0127] Here, the applet and the second code may share the memory.
[0128] As an example, the binary data stream of a compressed file can be passed to a WebAssembly module. In the memory management mechanism of WebAssembly, data is stored in the memory in the form of an array. Therefore, the binary data stream can be converted into an object of type Uint8Array and passed to the memory array of the WebAssembly module. This process can use the readFile function of the applet to obtain the binary data stream of the compressed file and then convert it into an object of type Uint8Array. Thus, by running the second code in the applet, the object corresponding to the compressed file in the memory can be read to achieve decompression of the target file.
[0129] It can be understood that in the above optional implementation method, the binary data stream of the compressed file can be converted into an object of a preset array type and then stored in the memory. In this way, by directly operating the data stream in the memory, I / O (InputOutput) operations can be minimized, thereby improving the execution efficiency of the program and reducing memory overhead.
[0130] In some optional implementations of this embodiment, a node of a file tree is used to represent first file data of a file in the compressed file. Each first file data is associated with second file data of a corresponding file in the compressed file. The first file data is stored in a memory. The first file data is a file identifier. The second file data is obtained by decompression, and the second file data is stored in a stack.
[0131] It can be understood that in the above optional implementation, the first file data is stored through the memory, and the second file data is stored through the stack. In this way, the memory occupancy can be further reduced, thereby improving the stability of the second code running in the applet.
[0132] Step 104: Run the second code in the applet to decompress the compressed file.
[0133] In this embodiment, the format of the compressed file may be determined first, and then a corresponding algorithm may be used to decompress the compressed file.
[0134] In practice, a portion of the beginning of each file (including compressed files) may contain metadata information used to determine the file format. Thus, the file format can be determined by a Magic Number, which is a special sequence of numbers or bytes that can be used to determine the file format.
[0135] Here, JS code may be used to execute the above step 104 so as to run the second code in the applet, thereby decompressing the compressed file.
[0136] In some optional implementations of this embodiment, the following method may be used to decompress the compressed file:
[0137] First, the compressed file is stored in a memory, so as to decompress the compressed file through the memory.
[0138] Afterwards, after the compressed file is decompressed through the memory, the compressed file is transferred to the stack, and the memory used to store the compressed file is recovered.
[0139] It can be understood that in the above optional implementation, after the file is decompressed, the memory corresponding to the decompressed file can be recovered and transferred to the stack, thereby reducing the heap memory usage and further improving the stability of the second code running in the mini program.
[0140] The method for decompressing a compressed file provided in an embodiment of the present application can obtain a first code, wherein the first code at least partially does not support running on a mini-program, and the first code is used to decompress the compressed file, and then the first code is compiled into a second code, wherein the second code supports running on the mini-program, and then the compressed file is obtained, and then the second code is run in the mini-program to decompress the compressed file. As a result, the code for decompressing the compressed file can be run on the front end of the mini-program without uploading and downloading files, which reduces the time of network transmission and relieves the pressure on the back-end server. In addition, it can also avoid problems such as data leakage and file damage in sensitive file transmission, thereby improving the efficiency and security of file decompression.
[0141] Figure 2 A flowchart of another method for decompressing a compressed file provided in an embodiment of the present application. Figure 2 As shown, the method specifically includes:
[0142] Step 201, obtaining a first code, wherein at least part of the first code does not support running on a mini-program, and the first code is used to decompress the compressed file. Then, step 202 is executed.
[0143] In this embodiment, step 201 and Figure 1 Step 101 in the corresponding embodiment is basically the same and will not be described again here.
[0144] Step 202: compile the first code into a second code, wherein the second code supports running on the applet. Then, step 203 is executed.
[0145] In this embodiment, step 202 and Figure 1 Step 102 in the corresponding embodiment is basically the same and will not be described again here.
[0146] Step 203, obtaining the compressed file. Then, executing step 204.
[0147] In this embodiment, step 203 and Figure 1 Step 103 in the corresponding embodiment is basically the same and will not be described again here.
[0148] Step 204, determining the compressed file as a target file, and performing the following decompression steps.
[0149] In this embodiment, the decompression step includes steps 211-213.
[0150] Step 211, running the second code in the applet to decompress the target file. Then, executing step 212.
[0151] In this embodiment, the format of the target file may be determined first, and then a corresponding algorithm may be used to decompress the target file.
[0152] In practice, a portion of the beginning of each file (including the target file and the decompressed file) may contain metadata information used to determine the file format. Therefore, the file format can be determined by the Magic Number. Among them, Magic Number is a special sequence of numbers or bytes that can be used to determine the file format.
[0153] In some optional implementations of this embodiment, the target file may be decompressed in the following manner:
[0154] First, the target file is stored in a memory, so as to decompress the target file through the memory.
[0155] Afterwards, after the target file is decompressed through the memory, the target file is transferred to the stack, and the memory used to store the target file is reclaimed.
[0156] It can be understood that in the above optional implementation, after the file is decompressed, the memory corresponding to the decompressed file can be recovered and transferred to the stack, thereby reducing the heap memory usage and further improving the stability of the second code running in the mini program.
[0157] Step 212, determine whether the decompressed file includes a compressed file. If yes, execute step 205; if no, execute step 213.
[0158] In this embodiment, after decompressing the compressed file (hereinafter referred to as file A), the decompressed file can be obtained, and the format of the compressed file included in the decompressed file can be the same as or different from the format of the above-mentioned file A. For example, the decompressed file obtained by decompressing the ZIP format file A can include a RAR format file.
[0159] Step 213, confirm that the decompression is completed.
[0160] Step 205: determine the compressed file in the decompressed file as the target file. Then, execute the above step 211.
[0161] It should be noted that, in addition to the above contents, this embodiment may also include Figure 1 The corresponding technical features described in the corresponding embodiments are realized Figure 1 For details, please refer to Figure 1 For the sake of brevity, the relevant description is not repeated here.
[0162] The compressed file decompression method provided in the embodiment of the present application can support decompression of compressed files within a compressed file so as to fully decompress all files within the compressed file, thereby improving the convenience and comprehensiveness of file decompression.
[0163] Figure 3 A flowchart of another method for decompressing a compressed file provided in an embodiment of the present application.
[0164] Specifically, if Figure 3 As shown, the method specifically includes:
[0165] Step 301: Obtain a first code, wherein at least a portion of the first code does not support running on a mini-program, and the first code is used to decompress the compressed file.
[0166] In this embodiment, step 301 and Figure 1 Step 101 in the corresponding embodiment is basically the same and will not be described again here.
[0167] Step 302: compile the first code into a second code, wherein the second code supports running on the applet.
[0168] In this embodiment, step 302 and Figure 1 Step 102 in the corresponding embodiment is basically the same and will not be described again here.
[0169] Step 303: Obtain the compressed file.
[0170] In this embodiment, step 303 and Figure 1Step 103 in the corresponding embodiment is basically the same and will not be described again here.
[0171] Step 304: Run the second code in the applet to decompress the compressed file.
[0172] In this embodiment, step 304 and Figure 1 Step 104 in the corresponding embodiment is basically the same and will not be described again here.
[0173] Step 305: store the decompressed file in the cloud.
[0174] In this embodiment, the decompressed file is stored in the cloud to back up the decompressed file.
[0175] In some optional implementations of this embodiment, after executing the above step 305, the following steps may also be executed:
[0176] First, a viewing operation performed on the decompressed file is detected.
[0177] Afterwards, when the viewing operation is detected, the decompressed file stored locally is displayed, or the decompressed file stored in the cloud is displayed.
[0178] It can be understood that in the above optional implementation method, after the decompressed file is stored in the cloud, if the user needs to view the decompressed file, the decompressed file can be obtained from the local or cloud so as to display the decompressed file, thereby preventing the decompressed file from being lost due to the closure of the mini program.
[0179] The compressed file decompression method provided in the embodiment of the present application can store the decompressed file in the cloud by storing the decompressed file in the cloud, so as to back up the decompressed file.
[0180] The following is an illustrative description of the embodiments of the present application, but it should be noted that the embodiments of the present application may have the features described below, but the following description does not constitute a limitation on the scope of protection of the embodiments of the present application.
[0181] In the current technical environment, there is no mature file decompression solution in the industry for the time being in the front-end scenario. For example, traditional C++ / Rust applications need to run on local computers and cannot be used in the browser kernel in browsers and web applications. The server-side decompression solution needs to upload files to the server, which requires more computing resources and time, and there are certain risks in terms of privacy and security.
[0182] Among them, local computers and browsers belong to different technical branches. The browser technology is mainly applied to HTML (HyperText Markup Language) applications, which is a trend. It can be developed on one platform and used on multiple platforms. However, the local applications of computers are limited by the platform. For example, applications in Mac and Windows need to be designed separately.
[0183] Compared with the above solution, the embodiment of the present application proposes a decompression solution based on WebAssembly technology, which can directly decompress RAR, 7z, and ZIP files on the mini program side. By using WebAssembly technology, the file operation performance can be improved by simulating the operating environment of C. In addition, the compatibility and ease of use of WebAssembly technology on the Web platform are also one of its advantages. Therefore, this solution can provide a faster, safer and more reliable file decompression experience.
[0184] Specifically, WebAssembly technology can be used to compile C++ / Rust code (i.e., the first code mentioned above) into WebAssembly binary format (i.e., the second code mentioned above), so that high-performance operation on the local computer can be achieved, and it can also be used directly in the browser. Secondly, through memory mapping technology, files (such as the compressed files and target files mentioned above) can be read into the memory, which can greatly improve the efficiency of file reading and parsing. At the same time, the file format is quickly determined by using file header recognition technology, so as to select the corresponding decompression algorithm. Finally, by optimizing the decompression algorithm, the memory usage and CPU (Central Processing Unit) usage can be reduced as much as possible while ensuring the decompression speed and file integrity. In addition, when decompressing files, there is no need to upload them to the server, and full decompression of compressed packages inside the compressed packages can be supported.
[0185] In this method, the binary data stream in the compressed package (that is, the compressed file mentioned above) can be passed to the WebAssembly module. In the memory management mechanism of WebAssembly, data is stored in the memory in the form of an array, so the data stream can be converted into an object of type Uint8Array (that is, the preset array type mentioned above) and passed to the memory array of the WebAssembly module. This process can be implemented using the readFile of the applet. The API (Application Programming Interface) can read the file as a binary data stream and then convert it into an object of type Uint8Array.
[0186] Next, the decompression function is implemented by writing the code of the WebAssembly module. WebAssembly is a low-level bytecode, which needs to be written in a high-level language such as C++, and then compiled into a WebAssembly module by a compiler. In this solution, the WebAssembly module can be written in C++. In the module, memory pool technology can be used for memory management. Among them, the memory pool is a method of pre-allocating a certain amount of memory, and then allocating memory from it when needed, avoiding frequent memory application and recycling, and improving efficiency. At the same time, the full decompression function of the compressed package inside the compressed package is also implemented, which is implemented using a recursive algorithm.
[0187] Among them, memory pool is a memory allocation technology that pre-allocates a certain number of memory blocks, called memory pools, and allocates memory from them when needed. Compared with the traditional dynamic memory allocation method, the advantage of memory pool is that it can avoid frequent memory application and recycling operations, thereby improving the running efficiency and performance of the program.
[0188] There are many ways to implement a memory pool, the most common of which is to use a linked list or array to manage the memory pool. When a program uses a memory pool for the first time, it creates a certain number of memory blocks and connects them into a linked list. When memory needs to be allocated, the program can look for a memory block of sufficient size from the linked list and put it back into the linked list after use. In this way, when the program needs to allocate memory again, it can look for an available memory block from the linked list instead of calling a system function to apply for memory.
[0189] The memory is stored using a linked list, and when reading a file, when the identifier of the beginning or end of the document is found, the memory is dynamically reclaimed. This can avoid the situation where the memory is automatically reclaimed by the applet to a certain extent, resulting in the loss of the decompressed file.
[0190] In addition to memory management and decompression algorithms, there may be compatibility issues when using WebAssembly modules in mini-programs. For example, WebAssembly has good compatibility on the Web platform, but there are still some compatibility issues in mini-programs. At the same time, you also need to pay attention to the issue of memory usage. Mini-programs have certain memory limits. If too much memory is used, the mini-program will be automatically killed, causing the program to crash. Therefore, the following method can be used to control memory usage in the program to avoid excessive memory usage causing program crashes.
[0191] (1) When compiling, you need to add the "-O3" option (that is, the target compilation option mentioned above) to greatly increase the compilation speed.
[0192] (2) The "-s USE_PTHREADS=0" option (that is, the target compilation option mentioned above) must be added during compilation because the iOS Safari browser is not compatible with the SharedArrayBuffer shared buffer.
[0193] (3) The "-s ALLOW_MEMORY_GROWTH=1" option (that is, the target compilation option mentioned above) needs to be added during compilation to solve the OOM problem that occurs when decoding very large compressed packages.
[0194] (4) Due to the compatibility issues of the mini-program environment, removing the SDL-related code added when libwebp is compiled in the glue JS code (that is, the second code mentioned above) can save about 100KB of space.
[0195] (5) Remove the ENVIRONMENT_IS_NODE / ENVIRONMENT_IS_SHELL related codes in the compiled glue JS code, because the mini program environment is not used.
[0196] (6) Due to compatibility issues with the iOS Safari browser, the streaming compilation and instantiation methods in the glue JS code are removed and replaced with non-streaming compilation and instantiation methods.
[0197] (7) When the new WebAssembly.Memory code in the glue JS code is run in the mini program environment, an error "refused to create a webassembly object without'unsafe-eval'" will be reported. This can only be solved by adding unsafe-eval to the CSP settings in page-frame.html.
[0198] (8) Mini Programs for iOS do not support exporting functions, Memory, and Table, and the iOS platform does not currently support Global.
[0199] (9) The mini program environment does not support many built-in codes in the glue JS code, such as new Function and other functional codes, which need to be converted into codes that can be recognized by the mini program.
[0200] In addition, multiple implementations may be used to achieve the same purpose in this method.
[0201] For example, for the above memory management solution, there may be alternative solutions such as using virtual memory or file swapping. Virtual memory is a technology that increases available memory by moving part of the content in the memory to the virtual storage in the hard disk to meet the memory needs of the process. However, the implementation of virtual memory involves a large number of hard disk I / O operations, which will lead to reduced program performance. At the same time, file swapping is also a technology that swaps the content in the memory to the hard disk, but it also has performance bottlenecks. In contrast, the use of a memory management solution can minimize I / O operations by directly operating the data stream in the memory, thereby improving the execution efficiency of the program.
[0202] In addition, there is no other mature solution for the above-mentioned compressed file decompression technology on the mini program side. Most of the existing solutions in the industry need to be completed with the help of the server, which reduces the user experience to a certain extent.
[0203] This method can solve the need for file decompression in the development of small programs. Previous decompression solutions often require uploading files to the back-end server, which increases the time of network transmission and the pressure on the server. This method uses WebAssembly technology to compile C++ / Rust code into a cross-platform low-level code (that is, the second code mentioned above). By directly executing the code on the front end of the small program, the network transmission time is shortened, the burden on the server is reduced, and the decompression efficiency and security are also guaranteed. In addition, this method also supports the decompression of files in multiple compression formats, as well as the decompression of compressed packages in compressed packages, which enhances the flexibility and comprehensiveness of the decompression solution, thereby providing a more efficient and convenient file decompression service, meeting the user's needs for file processing, and improving the user's experience.
[0204] It should be noted that, in addition to the contents recorded above, this embodiment may also include the technical features described in the above embodiments, so as to achieve the technical effects of the decompression method of the compressed file shown above. Please refer to the above description for details. For the sake of brevity, it will not be repeated here.
[0205] The decompression scheme of the present method is applicable to various document application scenarios based on mini-program development, including but not limited to the decompression of various document types such as e-books, PDF, Word, PPT, etc. By using the decompression scheme of the present method, users can quickly decompress documents on the front end of the mini-program, improving document processing efficiency and user experience. In addition, the WebAssembly technology of the present method can also be applied to other document application scenarios that require efficient processing of big data, such as document editing, reading, conversion and other fields, and can improve data processing efficiency and cross-platform compatibility. The present method uses WebAssembly technology to compile C++ / Rust code into executable code on the front end of the mini-program, realizes the decompression function of the front end of the mini-program, and avoids the disadvantage that the traditional decompression scheme needs to upload the file to the server. The present method supports a variety of compressed file formats, including RAR, 7z, ZIP and other formats, and supports decompression of compressed files inside the compressed package, improving the flexibility of decompression. The present method uses WebAssembly technology to run the existing C++ / Rust code on the front end of the mini-program without major changes, and has cross-platform compatibility. The present method effectively reduces the memory usage of the program through a fine reading, writing and recycling mechanism of the memory. Compared with the traditional file operation method, the present method does not need to read the entire file into the memory, but reduces the memory overhead by streaming the data. The decompression method of the present method can directly operate the file through streaming data, avoiding the time and space waste of decompressing the entire file and then operating in the traditional method. In addition, the present method uses memory reading and recycling technology, so that the file can be read and processed quickly and efficiently during the decompression process, thereby greatly improving the decompression speed and efficiency. The decompression method of the present method ensures the accuracy of decompression through fine memory management and streaming data operation, avoiding problems such as data loss or file damage that may occur in the traditional method. The decompression method of the present method uses streaming data operation, simplifies multiple operation steps in the traditional decompression method, so that the user can complete the decompression of all compressed files in the same file through simple operations, improving the user experience.
[0206] Figure 4 A schematic diagram of the structure of a compressed file decompression device provided in an embodiment of the present application.
[0207] Specifically include:
[0208] A first acquisition unit 401 is used to acquire a first code, wherein at least a part of the first code does not support running on a mini-program, and the first code is used to decompress the compressed file;
[0209] A compiling unit 402, configured to compile the first code into a second code, wherein the second code supports running on the applet;
[0210] A second obtaining unit 403 is used to obtain the compressed file;
[0211] The decompression unit 404 is used to run the second code in the applet to decompress the compressed file.
[0212] In a possible implementation manner, running the second code in the applet to decompress the compressed file includes:
[0213] The compressed file is determined as a target file, and the following decompression steps are performed: the second code is run in the applet to decompress the target file; whether the decompressed file obtained by decompression includes the compressed file; if the decompressed file does not include the compressed file, determining that the decompression is completed;
[0214] In the case that the compressed file is included in the decompressed file, the compressed file in the decompressed file is determined as a target file; and the decompression step is performed based on the determined target file.
[0215] In a possible implementation, decompressing the target file includes:
[0216] Storing the target file in a memory to decompress the target file through the memory;
[0217] After the target file is decompressed through the memory, the target file is transferred to the stack, and the memory used to store the target file is reclaimed.
[0218] In a possible implementation, obtaining the compressed file includes:
[0219] Obtaining a binary data stream of the compressed file;
[0220] Convert the binary data stream into an object of a preset array type;
[0221] Store the object in memory.
[0222] In a possible implementation manner, compiling the first code into a second code includes:
[0223] Using a target compilation option, compile the first code into a second code;
[0224] The target compilation option is used to perform at least one of the following operations: setting compilation speed, controlling shared buffer, and controlling memory consumption.
[0225] In a possible implementation manner, after the second code is executed in the applet to decompress the compressed file, the device further includes:
[0226] The storage unit (not shown in the figure) is used to store the decompressed files in the cloud.
[0227] In a possible implementation manner, after storing the decompressed file in the cloud, the device further includes:
[0228] a detection unit (not shown in the figure), used to detect a viewing operation performed on the decompressed file;
[0229] A display unit (not shown in the figure) is used to display the decompressed file stored locally or the decompressed file stored in the cloud when the viewing operation is detected.
[0230] In one possible implementation, a node of a file tree is used to represent first file data of a file in the compressed file; each first file data is associated with second file data of a corresponding file in the compressed file, the first file data is stored in a memory, and the first file data is a file identifier; the second file data is obtained by decompression, and the second file data is stored in a stack.
[0231] The decompression device for compressed files provided in this embodiment may be as follows: Figure 4 The compressed file decompression device shown in can execute all the steps of the compressed file decompression methods described above, thereby achieving the technical effects of the compressed file decompression methods described above. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.
[0232] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 5 The electronic device 500 shown includes: at least one processor 501, a memory 502, at least one network interface 504 and other user interfaces 503. The various components in the electronic device 500 are coupled together via a bus system 505. It is understood that the bus system 505 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 505 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 505 is not described in detail. Figure 5 Various buses are labeled as bus system 505 .
[0233] The user interface 503 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).
[0234] It can be understood that the memory 502 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct RAM bus random access memory (DRRAM). The memory 502 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0235] In some implementations, the memory 502 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 5021 and an application program 5022 .
[0236] Among them, the operating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 5022 includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present application can be included in the application 5022.
[0237] In this embodiment, by calling the program or instruction stored in the memory 502, specifically, the program or instruction stored in the application 5022, the processor 501 is used to execute the method steps provided by each method embodiment, for example, including:
[0238] Obtain a first code, wherein at least a portion of the first code does not support running on a mini-program, and the first code is used to decompress the compressed file;
[0239] Compiling the first code into a second code, wherein the second code supports running on the applet;
[0240] Obtaining the compressed file;
[0241] The second code is run in the applet to decompress the compressed file.
[0242] The method disclosed in the above embodiment of the present application can be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 501. The above processor 501 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and completes the steps of the above method in combination with its hardware.
[0243] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the above functions of the present application, or a combination thereof.
[0244] For software implementation, the technology described above in this article can be implemented by a unit that performs the functions described above in this article. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.
[0245] The electronic device provided in this embodiment may be Figure 5 The electronic device shown in can execute all steps of the decompression methods of the compressed files described above, thereby achieving the technical effects of the decompression methods of the compressed files described above. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.
[0246] The embodiment of the present application also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.
[0247] When one or more programs in the storage medium can be executed by one or more processors, the compressed file decompression method executed on the electronic device side can be implemented.
[0248] The processor is used to execute the decompression program of the compressed file stored in the memory to implement the following steps of the decompression method of the compressed file executed on the electronic device side:
[0249] Obtain a first code, wherein at least a portion of the first code does not support running on a mini-program, and the first code is used to decompress the compressed file;
[0250] Compiling the first code into a second code, wherein the second code supports running on the applet;
[0251] Obtaining the compressed file;
[0252] The second code is run in the applet to decompress the compressed file.
[0253] The professionals should also be further aware that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. 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.
[0254] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0255] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0256] The foregoing is merely a specific embodiment of the method, which enables those skilled in the art to understand or implement the method. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the method. Therefore, the method will not be limited to the embodiments shown herein, but rather to the widest range consistent with the principles and novel features claimed herein.
Claims
1. A method for decompressing a compressed file, characterized in that: The method comprises: Obtain a first code, wherein at least a portion of the first code does not support running on a mini-program, and the first code is used to decompress the compressed file; Compiling the first code into a second code, wherein the second code supports running on the applet; Obtaining the compressed file; The second code is run in the applet to decompress the compressed file.
2. The method according to claim 1, characterized in that The step of running the second code in the applet to decompress the compressed file comprises: The compressed file is determined as a target file, and the following decompression steps are performed: the second code is run in the applet to decompress the target file; whether the decompressed file obtained by decompression includes the compressed file; if the decompressed file does not include the compressed file, determining that the decompression is completed; In the case that the compressed file is included in the decompressed file, the compressed file in the decompressed file is determined as a target file; and the decompression step is performed based on the determined target file.
3. The method according to claim 2, characterized in that The decompressing the target file comprises: Storing the target file in a memory to decompress the target file through the memory; After the target file is decompressed through the memory, the target file is transferred to the stack, and the memory used to store the target file is reclaimed.
4. The method according to claim 1, characterized in that: The obtaining of the compressed file comprises: Obtaining a binary data stream of the compressed file; Convert the binary data stream into an object of a preset array type; storing the object in memory; and The step of running the second code in the applet to decompress the target file comprises: The second code is run in the applet to read the object corresponding to the compressed file in the memory to decompress the target file.
5. The method according to claim 1, characterized in that The compiling the first code into a second code comprises: Using a target compilation option, compile the first code into a second code; The target compilation option is used to perform at least one of the following operations: setting compilation speed, controlling shared buffer, and controlling memory consumption.
6. The method according to claim 1, characterized in that After running the second code in the applet to decompress the compressed file, the method further includes: Store the decompressed files in the cloud.
7. The method according to claim 6, characterized in that After storing the decompressed file in the cloud, the method further includes: detecting a viewing operation performed on the decompressed file; When the viewing operation is detected, the decompressed file stored locally is displayed, or the decompressed file stored in the cloud is displayed.
8. The method according to any one of claims 1 to 7, characterized in that: The nodes of the file tree are used to represent the first file data of the files in the compressed file; each of the first file data is associated with the second file data of the corresponding file in the compressed file, the first file data is stored in the memory, and the first file data is a file identifier; the second file data is obtained by decompression, and the second file data is stored in the stack.
9. A decompression device for compressed files, characterized in that: The device comprises: A first acquisition unit is used to acquire a first code, wherein at least a part of the first code does not support running on the applet, and the first code is used to decompress the compressed file; A compiling unit, configured to compile the first code into a second code, wherein the second code supports running on the applet; A second obtaining unit, used to obtain the compressed file; A decompression unit is used to run the second code in the applet to decompress the compressed file.
10. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute a computer program stored in the memory, and when the computer program is executed, implement the method described in any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method described in any one of claims 1 to 8 is implemented.
