File volume processing method, device and server
By automating the comparison of static resource file size changes, the problem of low efficiency and error-proneness of manual comparison is solved, achieving efficient and accurate file size management and improving website performance and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA CONSTRUCTION BANK
- Filing Date
- 2023-03-28
- Publication Date
- 2026-05-01
AI Technical Summary
In existing technologies, manual comparison of static resource files is inefficient and prone to errors due to its large file size, which affects website performance and user experience.
An automated method is provided that acquires and saves static resource information, uses a preset configuration table to filter file extensions and names that participate in and do not participate in volume change analysis, automatically compares the volume of static resource files packaged in the current and previous batches, generates volume change information, and performs elimination processing.
It enables efficient and accurate comparison of static resource file size changes, improving processing efficiency, reducing human error, and enhancing website performance and user experience.
Smart Images

Figure CN116304466B_ABST
Abstract
Description
File size processing methods, devices, and servers Technical Field
[0001] This disclosure relates to Internet technology, and more particularly to a method, apparatus, and server for processing file volume. Background Technology
[0002] Excessively large static resource file sizes on a website can impact rendering (display) time. Larger static resource file sizes consume more network transmission time, as well as browser parsing and execution time. Therefore, excessively large static resource file sizes negatively affect website performance, consequently impacting user experience and hindering user retention and conversion. When excessively large static resource file sizes are detected, it's necessary to analyze the reasons behind them and address the issue.
[0003] In existing technologies, technicians typically need to manually navigate to the packaged project directory to check the file sizes of static resources in the current and previous packages. Then, they need to manually compare the file sizes of the current and previous packages to analyze the reasons for the excessively large file sizes and eliminate the problem.
[0004] However, the above-mentioned manual comparison method is inefficient and prone to errors. Summary of the Invention
[0005] This disclosure provides a file size processing method, apparatus, and server to solve the problem that manual comparison of the file size of static resources packaged in the current and previous batches is inefficient and prone to errors.
[0006] According to a first aspect of this disclosure, a file size processing method, apparatus, and server are provided, including:
[0007] The system acquires and packages the static resources of the web page according to the packaging instructions, generates static resource information, and saves the static resource information in a preset storage space; wherein, the static resource information includes multiple static resource files and the file size of each static resource file;
[0008] If it is determined that the packaging of the static resources of the WEB page is not the first packaging, then extract the static resource files whose file extensions belong to the file extensions participating in the volume change analysis from the current static resource information saved in the preset storage space, and remove the files whose file extensions belong to the file extensions not participating in the volume change analysis and the files whose file names belong to the file names not participating in the volume analysis from the extracted static resource files, and obtain the first static resource information.
[0009] Extract static resource files whose file extensions belong to the file extensions participating in volume change analysis from the previous static resource information adjacent to the current static resource information stored in the preset storage space, and remove files whose file extensions belong to the file extensions not participating in volume change analysis and files whose file names belong to the file names not participating in volume analysis from the extracted static resource files to obtain the second static resource information.
[0010] Based on the first static resource information and the second static resource information, the volume change of the static resource file in the first static resource information is determined. Based on the volume change of the static resource file in the first static resource information, when it is determined that the file size of the static resource of the WEB page is too large, the file size of the static resource of the WEB page is eliminated.
[0011] According to a second aspect of this disclosure, an apparatus for determining file size changes of static resources of a web page is provided, comprising:
[0012] The packaging unit is used to obtain and package the static resources of the web page according to the packaging instructions, and generate static resource information.
[0013] A storage unit is used to store the static resource information in a preset storage space; wherein the static resource information includes multiple static resource files and the file size of each static resource file;
[0014] The acquisition unit is configured to, if it is determined that the packaging of the static resources of the WEB page is not the first packaging, extract static resource files whose file extensions belong to the file extensions participating in the volume change analysis from the current static resource information stored in the preset storage space, and remove files whose file extensions belong to the file extensions not participating in the volume change analysis and files whose file names belong to the file names not participating in the volume analysis from the extracted static resource files, thereby obtaining the first static resource information.
[0015] The acquisition unit is further configured to extract static resource files whose file extensions belong to the file extensions participating in volume change analysis from the previous static resource information adjacent to the current static resource information stored in the preset storage space, and remove files whose file extensions belong to the file extensions not participating in volume change analysis and files whose file names belong to the file names not participating in volume analysis from the extracted static resource files, thereby obtaining the second static resource information.
[0016] The analysis unit is configured to determine the volume change of static resource files in the first static resource information based on the first static resource information and the second static resource information; and to perform file size reduction processing on the static resources of the web page when it is determined that the file size of the static resources of the web page is too large based on the volume change of the static resource files in the first static resource information.
[0017] According to a third aspect of this disclosure, a server is provided, including a memory and a processor; wherein,
[0018] The memory is used to store computer programs;
[0019] The processor is configured to read the computer program stored in the memory and execute the file volume processing method, apparatus, and server as described in the first aspect according to the computer program in the memory.
[0020] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided, wherein computer-executable instructions are stored therein, and when a processor executes the computer-executable instructions, the file volume processing method, apparatus and server as described in the first aspect are implemented.
[0021] According to a fifth aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the file volume processing method, apparatus, and server as described in the first aspect.
[0022] The file volume processing method, apparatus, and server disclosed herein include: acquiring and packaging static resources of a web page according to a packaging instruction, generating static resource information, and storing the static resource information in a preset storage space; wherein, the static resource information includes multiple static resource files and the file size of each static resource file; if it is determined that the packaging of the static resources of the web page is not the first packaging, then extracting static resource files whose file extensions belong to the file extensions participating in volume change analysis from the current static resource information stored in the preset storage space, and removing files whose file extensions belong to the file extensions not participating in volume change analysis and files whose file names belong to the file names not participating in volume analysis from the extracted static resource files, thereby obtaining the first... The system firstly extracts static resource information. It then extracts static resource files whose file extensions belong to the file extensions involved in volume change analysis from the previous static resource information adjacent to the current static resource information stored in a preset storage space. Files with file extensions not involved in volume change analysis and files with file names not involved in volume change analysis are removed from the extracted static resource files to obtain second static resource information. Based on the first and second static resource information, the system determines the volume change of static resource files in the first static resource information. When the file size of static resources on a web page is determined to be too large based on the volume change of static resource files in the first static resource information, the system performs file size reduction processing on the static resources of the web page. The file size processing method, device, and server provided in this solution can automatically compare and display the file sizes of static resources in the current and previous packages, which is highly efficient and less prone to errors. Furthermore, it can utilize pre-set file extensions involved in volume change analysis, as well as file extensions and file names not involved in volume change analysis, to compare the file sizes of static resources in the current and previous packages in a more flexible manner. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 is a schematic flowchart illustrating a file volume processing method according to an exemplary embodiment of this disclosure;
[0025] Figure 2 is a schematic flowchart illustrating a file volume processing method according to another exemplary embodiment of this disclosure;
[0026] Figure 3 is a schematic diagram illustrating the display volume change in an exemplary embodiment of this disclosure;
[0027] Figure 4 is a schematic diagram illustrating the process of file size change of static resources displaying a web page, as shown in an exemplary embodiment of this disclosure.
[0028] Figure 5 is a structural diagram of a file volume processing apparatus according to an exemplary embodiment of the present disclosure;
[0029] Figure 6 is a structural diagram of a server shown in an exemplary embodiment of this disclosure. Detailed Implementation
[0030] Front-end projects (such as personal computer websites and mobile HTML5 web pages) typically use tools like webpack to bundle static resources, which are then deployed on a server to display the website or HTML5 web pages. Meanwhile, the project code is usually managed using version control tools.
[0031] Excessively large static resource file sizes on a website (web page) can impact rendering (display) time. Larger static resource file sizes consume more network transmission time, as well as browser parsing and execution time. Therefore, excessively large static resource file sizes negatively affect website performance, consequently impacting user experience and hindering user retention and conversion. When excessively large static resource file sizes are detected, it's necessary to analyze the reasons for this and address the issue.
[0032] In existing technologies, technicians typically need to manually navigate to the packaging project directory to check the file sizes of static resources in the current and previous packages, or use a packaging tool to check the file sizes of static resources in the current and previous packages. Then, technicians need to manually compare the file sizes of the current and previous packages to analyze the reasons for the excessively large file sizes and eliminate the problem.
[0033] However, the above-mentioned manual comparison method is inefficient and prone to errors.
[0034] To address the aforementioned technical issues, the solution provided in this disclosure can automatically compare and display the file sizes of static resources packaged in the current and previous batches, offering high efficiency and minimizing errors. Furthermore, it allows for the configuration of file extensions that participate in volume change analysis, as well as file extensions and filenames that do not participate, based on a preset configuration table, enabling a more flexible comparison of file sizes between the current and previous batches of static resources.
[0035] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0036] The technical solutions of this disclosure and how they solve the aforementioned technical problems will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this disclosure will now be described with reference to the accompanying drawings.
[0037] Figure 1 is a schematic flowchart illustrating a file volume processing method according to an exemplary embodiment of this disclosure.
[0038] As shown in Figure 1, the file size processing method provided in this embodiment includes:
[0039] Step 101: Obtain and package the static resources of the WEB page according to the packaging instructions, generate static resource information, and save the static resource information in the preset storage space; wherein, the static resource information includes multiple static resource files and the file size of each static resource file.
[0040] The method provided in this disclosure can be executed by a server.
[0041] The server can obtain packaging instructions and, based on these instructions, package the static resources of a web page to generate static resource information. This static resource information can then be saved in a preset storage space.
[0042] This static resource information may include multiple static resource files and the file size of each static resource file. Specifically, static resource files include files that can be opened by a browser (such as HTML files), website page style files, files responsible for website interaction (such as JavaScript files), as well as image resource files and font resource files, etc.
[0043] The preset storage space is a pre-defined storage space. This preset storage space can be located on the local disk.
[0044] Step 102: If it is determined that the packaging of static resources of the WEB page is not the first packaging, then extract the static resource files whose file extensions belong to the file extensions participating in the volume change analysis from the current static resource information saved in the preset storage space, and remove the files whose file extensions belong to the file extensions not participating in the volume change analysis and the files whose file names belong to the file names not participating in the volume analysis from the extracted static resource files, and obtain the first static resource information.
[0045] Specifically, you can first obtain the file extensions that participate in the volume change analysis, as well as the file extensions and file names that do not participate in the volume change analysis, from the preset configuration table.
[0046] The preset configuration table is a pre-configured table based on actual conditions. This preset configuration table can include file extensions that participate in volume change analysis. It can also include file extensions and file names that do not participate in volume change analysis.
[0047] Specifically, it can respond to the operation instructions of technicians and, based on those instructions, perform operations such as adding, deleting, or modifying the file extensions and file names that participate in volume change analysis and do not participate in volume change analysis, as well as the file names that do not participate in volume analysis, as included in the preset configuration table.
[0048] Specifically, the file extensions that participate in volume change analysis, as well as the file extensions and file names that do not participate in volume change analysis, can be obtained from the preset configuration table.
[0049] Specifically, if it is determined that the packaging of static resources for the web page is not the first packaging, then static resource files whose file extensions belong to the file extensions participating in the volume change analysis can be extracted from the current static resource information saved in the preset storage space (the current static resource information is the latest static resource information saved in the preset storage space). Then, files whose file extensions belong to the file extensions not participating in the volume change analysis and files whose file names belong to the file names not participating in the volume analysis can be removed from the extracted static resource files. The first static resource information can be generated using the remaining static resource files and their corresponding file sizes.
[0050] Step 103: Extract static resource files whose file extensions belong to the file extensions participating in volume change analysis from the previous static resource information adjacent to the current static resource information stored in the preset storage space. Remove files whose file extensions belong to the file extensions not participating in volume change analysis and files whose file names belong to the file names not participating in volume analysis from the extracted static resource files to obtain the second static resource information.
[0051] Specifically, static resource files whose file extensions belong to the file extensions participating in volume change analysis can be extracted from the previous static resource information adjacent to the current static resource information stored in the preset storage space. Then, files whose file extensions belong to the file extensions not participating in volume change analysis and files whose file names belong to the file names not participating in volume analysis can be removed from the extracted static resource files. The second static resource information can be generated using the remaining static resource files and their corresponding file sizes.
[0052] Step 104: Based on the first static resource information and the second static resource information, determine the size change of the static resource files in the first static resource information, so as to eliminate the file size of the static resources of the web page when it is determined that the file size of the static resources of the web page is too large based on the size change of the static resource files in the first static resource information.
[0053] Specifically, all static resource files included in the first static resource information can be traversed. If a static resource file in the first static resource information also exists in the second static resource information, the difference between the file size of the static resource file in the first static resource information and the file size in the second static resource information is determined as the volume change of the static resource file. Alternatively, if a static resource file in the first static resource information does not exist in the second static resource information (indicating that the static resource file is a newly added file), the file size of the static resource file in the first static resource information is determined as the volume change of the static resource file.
[0054] Furthermore, based on the changes in the size of static resource files in the first static resource information, when it is determined that the file size of the static resources of the web page is too large, the file size of the static resources of the web page can be reduced.
[0055] Furthermore, it can also display the size changes of each static resource file in the first static resource information.
[0056] The file volume processing method, apparatus, and server disclosed herein include: acquiring and packaging static resources of a web page according to a packaging instruction, generating static resource information, and storing the static resource information in a preset storage space; wherein, the static resource information includes multiple static resource files and the file size of each static resource file; if it is determined that the packaging of the static resources of the web page is not the first packaging, then extracting static resource files whose file extensions belong to the file extensions participating in volume change analysis from the current static resource information stored in the preset storage space, and removing files whose file extensions belong to the file extensions not participating in volume change analysis and files whose file names belong to the file names not participating in volume analysis from the extracted static resource files, thereby obtaining the first... First, static resource information is generated. From the previous static resource information adjacent to the current static resource information stored in a preset storage space, static resource files with file extensions belonging to the file extensions participating in volume change analysis are extracted. Files with file extensions not participating in volume change analysis and files with file names not participating in volume change analysis are removed from the extracted static resource files, resulting in second static resource information. Based on the first and second static resource information, the volume change of static resource files in the first static resource information is determined. Based on the volume change of static resource files in the first static resource information, when the file size of static resources on the web page is determined to be too large, the file size of static resources on the web page is eliminated. This solution can automatically compare and display the file sizes of static resources in the current and previous packages, which is efficient and less prone to errors. Furthermore, it can utilize pre-set file extensions participating in volume change analysis, as well as file extensions and file names not participating in volume change analysis, to compare the file sizes of static resources in the current and previous packages in a more flexible manner.
[0057] Figure 2 is a flowchart illustrating a file volume processing method according to another exemplary embodiment of this disclosure.
[0058] As shown in Figure 2, the file size processing method provided in this embodiment includes:
[0059] Step 201: Obtain and package the static resources of the WEB page according to the packaging instructions to generate static resource information. If it is determined that the file name of the static resource file included in the static resource information contains a placeholder, delete the placeholder in the file name to obtain the target name, and use the target name to update the file name of the corresponding static resource file in the static resource information to obtain the updated static resource information; save the updated static resource information in the preset storage space; wherein, the static resource information includes multiple static resource files and the file size of each static resource file.
[0060] Specifically, when a static resource file in the static resources is updated for the first time, a placeholder will be added to the file name of the static resource file; thereafter, the placeholder will be updated accordingly every time the static resource file is updated.
[0061] Specifically, it can acquire and, based on the bundling instructions, use a preset bundling plugin (such as the Webpack plugin) to bundle the static resources of a web page, generating static resource information. It can detect whether the filenames of the static resource files included in the static resource information contain placeholders. If it is determined that the filenames of the static resource files included in the static resource information contain placeholders, the placeholders are removed to obtain the target name. The target name is then used to update the filenames of the corresponding static resource files in the static resource information, thus obtaining the updated static resource information. The updated static resource information can then be saved in a preset storage space.
[0062] The static resource information includes multiple static resource files and the file size of each static resource file.
[0063] In one possible implementation, if it is determined that the filename of a static resource file included in the static resource information contains an octet between two dots, and the file extension in the filename is adjacent to the octet, then the octet is determined as a placeholder contained in the filename.
[0064] Specifically, if it is determined that the file name of a static resource file included in the static resource information contains an eight-character string between two dots, and the file extension in the file name is adjacent to the eight-character string, then the eight-character string can be identified as a placeholder contained in the file name.
[0065] Step 202: If it is determined that the packaging of static resources of the WEB page is not the first packaging, then extract the static resource files whose file extensions belong to the file extensions participating in the volume change analysis from the current static resource information saved in the preset storage space, and remove the files whose file extensions belong to the file extensions not participating in the volume change analysis and the files whose file names belong to the file names not participating in the volume analysis from the extracted static resource files, and obtain the first static resource information.
[0066] Specifically, the principle and implementation of step 202 are similar to those of step 102, and will not be repeated here.
[0067] Step 203: Extract static resource files whose file extensions belong to the file extensions participating in volume change analysis from the previous static resource information adjacent to the current static resource information stored in the preset storage space. Remove files whose file extensions belong to the file extensions not participating in volume change analysis and files whose file names belong to the file names not participating in volume analysis from the extracted static resource files to obtain the second static resource information.
[0068] Specifically, after step 203, you can execute either step 204 or step 205.
[0069] Specifically, the principle and implementation of step 203 are similar to those of step 103, and will not be repeated here.
[0070] Step 204: If it is determined that the file name of the static resource file in the first static resource information exists in the second static resource information, then the difference between the file size of the static resource file corresponding to the file name in the first static resource information and the file size of the static resource file corresponding to the file name in the second static resource information is determined as the volume change of the static resource file corresponding to the file name.
[0071] Specifically, after step 204, step 206 can be executed.
[0072] Specifically, if it is determined that the file name of the static resource file in the first static resource information exists in the second static resource information, then the difference between the file size of the static resource file corresponding to the file name in the first static resource information and the file size of the static resource file corresponding to the file name in the second static resource information can be determined as the volume change of the static resource file corresponding to the file name.
[0073] Step 205: If it is determined that the file name of the static resource file in the first static resource information does not exist in the second static resource information, then the file size of the static resource file corresponding to the file name in the first static resource information is determined as the volume change of the static resource file corresponding to the file name.
[0074] Specifically, if it is determined that the file name of the static resource file in the first static resource information does not exist in the second static resource information, then the file size of the static resource file corresponding to the file name of the static resource file in the first static resource information can be determined as the volume change of the static resource file corresponding to that file name.
[0075] For example, if it is determined that the packaging of static resources for a web page is the first packaging, then static resource files whose file extensions belong to the file extensions participating in the volume change analysis can be extracted from the current static resource information stored in the preset storage space. Files whose file extensions do not participate in the volume change analysis, and files whose file names belong to file names not participating in the volume change analysis, can then be removed from the extracted static resource files to obtain the first static resource information. The file size of the static resource file corresponding to the file name in the first static resource information can then be determined as the volume change of the static resource file corresponding to that file name.
[0076] Step 206: Display the volume change according to a preset method, so that when the file size of the static resource of the WEB page is determined to be too large based on the volume change of the static resource file in the first static resource information, the file size of the static resource of the WEB page is eliminated.
[0077] Specifically, the file names and size changes of each static resource file included in the first static resource information can be displayed. Based on the size changes of the static resource files in the first static resource information, when it is determined that the file size of the static resources of the web page is too large, the file size of the static resources of the web page can be reduced.
[0078] Furthermore, it can also display the file size of each static resource file included in the first static resource information.
[0079] Optionally, if it is determined that the file size of the static resource file meets the preset requirements, the display method of the static resource file's file size can be adjusted.
[0080] For example, the file size of static resource files is usually displayed in bytes (B). However, representing file size in bytes is not intuitive; users are more accustomed to describing file size in kilobytes (K), megabytes (M), and gigabytes (G). B, KB, MB, and GB are converted to 1024, such as 1KB = 1024B. Therefore, by converting the file size unit according to a pre-set method, the file size can be displayed in a more user-friendly way.
[0081] For example, if the file size of a static resource file / 1024 < 1024, meaning the file size of the static resource file is less than 1MB, then it is rounded to two decimal places and converted to KB (1KB = 2014B); if the file size of a static resource file / 1024 >= 1024, and the file size of a static resource file / (1024 * 1024) < 1024, meaning the file size of the static resource file is greater than 1MB and less than 1GB, then it is rounded to two decimal places and converted to MB (1MB = 2014KB); if the file size of a static resource file / (1024 * 1024) >= 1024, meaning the file size of the static resource file is greater than 1GB, then it is rounded to two decimal places and converted to GB (1GB = 1024MB).
[0082] As shown in Figure 3, the file in Figure 3 displays the file name of the static resource file; the file size represents the file size of the static resource file, in bytes; the visual size is obtained by converting the unit of the file size according to the above method.
[0083] In one possible implementation, if it is determined that the size change of a static resource file meets preset conditions, the display method of the size change is adjusted.
[0084] Specifically, if it is determined that the size change of the static resource file meets the preset conditions, the display method of the size change can be adjusted.
[0085] For example, let the size change of a static resource file be 't'. If it's determined that the static resource file is a newly added static resource, then the size change 't' of the static resource file can be displayed in white; if it's determined that 't <= 0', then 't' can be displayed in green; if it's determined that 't > 0' and 't <= 20k', then 't' can be displayed in cyan; if it's determined that 't > 20k' and 't <= 40k', then 't' can be displayed in yellow; if it's determined that 't > 40k', then 't' can be displayed in red. For example, as shown in Figure 3, the file size difference in Figure 3 refers to the size change of the static resource file. The size change of the static resource file can be displayed according to the above method.
[0086] Figure 4 is a schematic diagram illustrating the process of file size change of static resources displaying a web page, as shown in an exemplary embodiment of this disclosure.
[0087] Specifically, after packaging the static resources according to the packaging instructions and generating static resource information, the file names of each static resource file in the static resource information can be obtained (i.e., obtaining the static resource file name in Figure 4). Then, it is determined whether the file name contains a placeholder. If it contains a placeholder, the placeholder is processed, that is, the placeholder is deleted to update the file name, obtain the updated static resource information, and save the updated static resource information in the preset storage space.
[0088] Next, the static resource information for this package and the static resource information from the previous package are retrieved from the preset storage space. The static resource files in the current package are then traversed to determine if they also exist in the previous package. If not, the static resource file is newly added (i.e., the static resource file in Figure 4 is newly added), and the file size difference (i.e., volume change) can be displayed in white. If the static resource file in the current package also exists in the previous package, the difference between the file size of the static resource file in the current package and the file size of the corresponding static resource file in the previous package is denoted as t. If t <= 0, the file size difference (t) can be displayed in green; if t > 0 and t <= 20k, the file size difference (t) can be displayed in cyan; if t > 20k and t <= 40k, the file size difference (t) can be displayed in yellow; otherwise, the file size difference (t) can be displayed in red.
[0089] In one possible implementation, the username of the user who triggered the packaging instruction and the packaging time of the static resources are obtained; log information is obtained from the code repository, and the latest commit information of the code corresponding to the static resources and the packaging branch information corresponding to the static resources are obtained from the log information.
[0090] Specifically, it can also retrieve the username of the user who triggered the packaging command, the packaging time of the static resources, and log information from the code repository (which can be a remote repository). From the log information, it can then retrieve the latest commit information of the code corresponding to the packaged static resources and the packaging branch information corresponding to those static resources.
[0091] Then, the username, packaging time, latest commit information, and packaging branch information are saved in the preset storage space.
[0092] Specifically, the username, packaging time, latest commit information, and packaging branch information can be saved in a preset storage space.
[0093] Display at least one of the following: username, build time, latest commit information, and build branch information.
[0094] Specifically, while saving the username, packaging time, latest commit information, and packaging branch information in the preset storage space, at least one of the following can also be displayed: the username of the user who triggered the packaging command, packaging time, latest commit information, and packaging branch information.
[0095] As shown in Figure 4, "Packaging Personnel" refers to the username of the user who triggered the packaging command; "Commit Identifier" refers to the latest commit information of the code corresponding to the packaged static resource; and "Packaging Branch" refers to the packaging branch information corresponding to the packaged static resource.
[0096] Specifically, it records and displays the username, packaging time, latest commit information, and packaging branch information of the user who triggered the packaging command. When project anomalies occur due to packaging static resources (such as selecting the wrong project branch or the wrong project version during packaging), the corresponding packaging person can be found based on the username, packaging time, and latest commit information to trace the packaging process.
[0097] Figure 5 is a structural diagram of a file volume processing apparatus shown in an exemplary embodiment of the present disclosure.
[0098] As shown in Figure 5, the file volume processing device 500 provided in this disclosure includes:
[0099] Packaging unit 510 is used to acquire and package the static resources of the WEB page according to the packaging instructions, and generate static resource information;
[0100] Storage unit 520 is used to store static resource information in a preset storage space; wherein, the static resource information includes multiple static resource files and the file size of each static resource file;
[0101] The acquisition unit 530 is used to extract static resource files whose file extensions belong to the file extensions participating in the volume change analysis from the current static resource information stored in the preset storage space if it is determined that the packaging of static resources of the WEB page is not the first packaging. It also removes files whose file extensions belong to the file extensions not participating in the volume change analysis and files whose file names belong to the file names not participating in the volume analysis from the extracted static resource files, thereby obtaining the first static resource information.
[0102] The acquisition unit 530 is also used to extract static resource files whose file extensions belong to the file extensions participating in volume change analysis from the previous static resource information adjacent to the current static resource information stored in the preset storage space, and to remove files whose file extensions belong to the file extensions not participating in volume change analysis and files whose file names belong to the file names not participating in volume analysis from the extracted static resource files, thereby obtaining the second static resource information.
[0103] The analysis unit 540 is used to determine the volume change of static resource files in the first static resource information based on the first static resource information and the second static resource information; and to perform file size reduction processing on the static resources of the web page when it is determined that the file size of the static resources of the web page is too large based on the volume change of the static resource files in the first static resource information.
[0104] The analysis unit 540 is specifically used to determine the difference between the file size of the static resource file corresponding to the file name in the first static resource information and the file size of the static resource file corresponding to the file name in the second static resource information if it is determined that the file name of the static resource file in the first static resource information exists in the second static resource information.
[0105] or,
[0106] If it is determined that the file name of the static resource file in the first static resource information does not exist in the second static resource information, then the file size of the static resource file corresponding to the file name in the first static resource information is determined as the volume change of the static resource file corresponding to the file name.
[0107] Storage unit 520 is specifically used to, if it is determined that the file name of the static resource file included in the static resource information contains a placeholder, delete the placeholder in the file name to obtain the target name, and use the target name to update the file name of the corresponding static resource file in the static resource information to obtain the updated static resource information.
[0108] The updated static resource information is saved in the preset storage space.
[0109] Storage unit 520 is specifically used to determine the eight-bit string as a placeholder in the file name if the file name of the static resource file included in the static resource information contains an eight-bit string between two dots, and the file extension in the file name is adjacent to the eight-bit string.
[0110] The file volume processing apparatus 500 provided in this disclosure further includes a display unit 550 for displaying volume changes according to a preset method.
[0111] The acquisition unit 530 is also used to acquire the username of the user who triggered the packaging instruction, as well as the packaging time of the static resources; and to acquire log information from the code repository, and from the log information, to acquire the latest commit information of the code corresponding to the static resources and the packaging branch information corresponding to the static resources;
[0112] Storage unit 520 is also used to save the username, packaging time, latest commit information, and packaging branch information in a preset storage space;
[0113] Display unit 550 is also used to display at least one of the following: username, packaging time, latest commit information, and packaging branch information.
[0114] Figure 6 is a structural diagram of a server shown in an exemplary embodiment of this disclosure.
[0115] As shown in Figure 6, the server provided in this embodiment includes:
[0116] Memory 601;
[0117] Processor 602; and
[0118] Computer programs;
[0119] The computer program is stored in memory 601 and configured to be executed by processor 602 to implement any of the file size processing methods, apparatuses, and servers described above.
[0120] This embodiment also provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement any of the file size processing methods, apparatuses, and servers described above.
[0121] This embodiment also provides a computer program product, including a computer program that, when executed by a processor, implements any of the above-described file size processing methods, apparatuses, and servers.
[0122] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0123] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for processing file size, characterized in that, include: The system acquires and packages the static resources of the web page according to the packaging instructions, generates static resource information, and saves the static resource information in a preset storage space. The static resource information includes multiple static resource files and the file size of each static resource file. If it is determined that the packaging of the static resources of the web page is not the first packaging, then static resource files whose file extensions belong to the file extensions participating in volume change analysis are extracted from the current static resource information saved in the preset storage space. Files whose file extensions belong to file extensions not participating in volume change analysis and files whose file names belong to file names not participating in volume analysis are also removed from the extracted static resource files, thus obtaining the first static resource information. From the preset storage space, extract static resource files whose file extensions belong to the file extensions participating in the volume change analysis from the previous static resource information adjacent to the current static resource information. Remove files whose file extensions do not participate in the volume change analysis and files whose file names do not participate in the volume change analysis from the extracted static resource files to obtain the second static resource information. The previous static resource information adjacent to the current static resource information refers to the static resource information generated in the last packaging of the current package. Based on the first static resource information and the second static resource information, determine the volume change of the static resource files in the first static resource information. Based on the volume change of the static resource files in the first static resource information, when it is determined that the file size of the static resources of the WEB page is too large, perform file size reduction processing on the static resources of the WEB page.
2. The method according to claim 1, characterized in that, The step of determining the volume change of the static resource file in the first static resource information based on the first static resource information and the second static resource information includes: if it is determined that the file name of the static resource file in the first static resource information exists in the second static resource information, then the difference between the file size of the static resource file corresponding to the file name in the first static resource information and the file size of the static resource file corresponding to the file name in the second static resource information is determined as the volume change of the static resource file corresponding to the file name; or, if it is determined that the file name of the static resource file in the first static resource information does not exist in the second static resource information, then the file size of the static resource file corresponding to the file name in the first static resource information is determined as the volume change of the static resource file corresponding to the file name.
3. The method according to claim 1, characterized in that, The step of storing the static resource information in a preset storage space includes: if it is determined that the file name of the static resource file included in the static resource information contains a placeholder, then the placeholder in the file name is deleted to obtain a target name, and the file name of the corresponding static resource file in the static resource information is updated using the target name to obtain the updated static resource information; and the updated static resource information is stored in the preset storage space.
4. The method according to claim 3, characterized in that, The step of determining that the file name of the static resource file included in the static resource information contains a placeholder includes: if the file name of the static resource file included in the static resource information contains an eight-character string between two dots, and the file extension in the file name is adjacent to the eight-character string, then the eight-character string is determined as a placeholder contained in the file name.
5. The method according to any one of claims 1-4, characterized in that, Also includes: The volume change is displayed according to a preset method.
6. The method according to any one of claims 1-4, characterized in that, Also includes: Obtain the username of the user who triggered the packaging instruction, and the packaging time of the static resources; And retrieve log information from the code repository, and retrieve the latest commit information of the code corresponding to the static resource and the packaging branch information corresponding to the static resource from the log information; The username, the packaging time, the latest commit information, and the packaging branch information are stored in the preset storage space; at least one of the following is displayed: the username, the packaging time, the latest commit information, and the packaging branch information.
7. A file volume processing device, characterized in that, include: The packaging unit is used to obtain and package the static resources of the web page according to the packaging instructions, and generate static resource information. A storage unit is used to store the static resource information in a preset storage space; wherein the static resource information includes multiple static resource files and the file size of each static resource file; an acquisition unit is used to, if it is determined that the packaging of the static resources of the WEB page is not the first packaging, extract static resource files whose file extensions belong to the file extensions participating in volume change analysis from the current static resource information stored in the preset storage space, and remove files whose file extensions belong to the file extensions not participating in volume change analysis and files whose file names belong to the file names not participating in volume analysis from the extracted static resource files, thereby obtaining first static resource information; the acquisition unit is also used to extract static resource files whose file extensions belong to the file extensions participating in volume change analysis from the previous static resource information adjacent to the current static resource information stored in the preset storage space, and remove files whose file extensions belong to the file extensions not participating in volume change analysis and files whose file names belong to the file names not participating in volume analysis from the extracted static resource information, thereby obtaining second static resource information; the previous static resource information adjacent to the current static resource information refers to the static resource information generated in the previous packaging of the current packaging; The analysis unit is configured to determine the volume change of static resource files in the first static resource information based on the first static resource information and the second static resource information; and to perform file size reduction processing on the static resources of the web page when it is determined that the file size of the static resources of the web page is too large based on the volume change of the static resource files in the first static resource information.
8. A server, characterized in that, The method includes a memory and a processor; wherein the memory is used to store a computer program; and the processor is used to read the computer program stored in the memory and execute the method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the method described in any one of claims 1-6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1-6.
Citation Information
Patent Citations
Method and device to preprocess application installation files and server
CN108089880A
Application resource updating method and device, resource packet manufacturing method and device, medium and equipment
CN110968334A