CN114065703A - File processing method and device, computer equipment and storage medium - Google Patents

File processing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114065703A
CN114065703A CN202111313454.0A CN202111313454A CN114065703A CN 114065703 A CN114065703 A CN 114065703A CN 202111313454 A CN202111313454 A CN 202111313454A CN 114065703 A CN114065703 A CN 114065703A
Authority
CN
China
Prior art keywords
target file
file
code block
compressed
inline
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111313454.0A
Other languages
Chinese (zh)
Inventor
许文辉
王余超
徐冰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan United Imaging Healthcare Co Ltd
Original Assignee
Wuhan United Imaging Healthcare Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan United Imaging Healthcare Co Ltd filed Critical Wuhan United Imaging Healthcare Co Ltd
Priority to CN202111313454.0A priority Critical patent/CN114065703A/en
Publication of CN114065703A publication Critical patent/CN114065703A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/14Tree-structured documents
    • G06F40/143Markup, e.g. Standard Generalized Markup Language [SGML] or Document Type Definition [DTD]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/14Tree-structured documents
    • G06F40/146Coding or compression of tree-structured data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/433Dependency analysis; Data or control flow analysis
    • G06F8/434Pointers; Aliasing

Abstract

The application relates to a file processing method, a file processing device, computer equipment and a storage medium. The method comprises the following steps: reading a target file in a front-end project to obtain at least one inline code block in the target file; replacing each inline code block with a preset placeholder code block to obtain a replaced target file; carrying out compression and confusion processing on the internal code block of the replaced target file to obtain a compressed and confused file; and filling the compressed and confused file to the corresponding position of each inline code block to obtain a processed target file. By adopting the method, the processing efficiency of the traditional web project compression confusion can be improved.

Description

File processing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a file processing method and apparatus, a computer device, and a storage medium.
Background
The top item (Web item) is a popular item running on the server, and the page is a result obtained by program operation on the server. In a traditional Web project, html files contain js codes, and the front-segment js codes containing business logic are directly exposed on a webpage, so that the safety problem exists, and meanwhile, the codes are not compressed, so that Web project resources are larger. Therefore, the html file needs to be compressed and obfuscated.
In the traditional technology, tools are compressed by manually copying codes needing to be compressed and confused in each html file, and then the compressed codes are pasted into the html file to obtain the html file after the compression processing.
However, the conventional compression aliasing processing method has the problem of low efficiency.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a file processing method, apparatus, computer device and storage medium capable of improving the efficiency of conventional web project compression obfuscation processing.
A method of file processing, the method comprising:
reading a target file in a front-end project to obtain at least one inline code block in the target file;
replacing each inline code block with a preset placeholder code block to obtain a replaced target file;
carrying out compression and confusion processing on the internal code block of the replaced target file to obtain a compressed and confused file;
and filling the compressed and confused file to the corresponding position of each inline code block to obtain a processed target file.
In one embodiment, the reading a target file in a front-end item to obtain at least one inline code block in the target file includes:
reading the content of the target file in a file stream mode to obtain a character string corresponding to the target file;
and searching the character string corresponding to the target file by adopting a character string matching search characteristic mode to obtain at least one inline code block in the target file.
In one embodiment, the searching the character string corresponding to the target file by using a character string matching search feature to obtain at least one inline code block in the target file includes:
performing characteristic search on the character string corresponding to the target file by adopting a character string matching search characteristic mode to obtain at least one inline code block in the target file; the inline code block is a module identified by script features.
In one embodiment, before replacing each of the inline code blocks with a preset placeholder code block to obtain a replaced target file, the method further includes:
generating an occupancy code block for each of the inline code blocks; the placeholder code chunks are unique and non-duplicative.
In one embodiment, the performing compression obfuscation on the inline code block of the replaced target file to obtain a compressed obfuscated file includes:
and performing compression and confusion processing on the internal code block of the replaced target file by adopting a preset confusion library to obtain the compressed and confused file.
In one embodiment, the filling the compressed and obfuscated file to a corresponding position of each of the inline code blocks to obtain a processed target file includes:
and performing matching backfill according to the file name of the compressed and confused file to obtain the processed target file.
In one embodiment, the method further comprises:
and acquiring the target file from a preset disk directory according to the directory of the front-end item.
A document processing apparatus, the apparatus comprising:
the reading module is used for reading a target file in a front-end project to obtain at least one inline code block in the target file;
the replacing module is used for replacing each inline code block by adopting a preset placeholder code block to obtain a replaced target file;
the first processing module is used for carrying out compression and confusion processing on the internal code block of the replaced target file to obtain a compressed and confused file;
and the second processing module is used for filling the compressed and confused file to the corresponding position of each inline code block to obtain a processed target file.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
reading a target file in a front-end project to obtain at least one inline code block in the target file;
replacing each inline code block with a preset placeholder code block to obtain a replaced target file;
carrying out compression and confusion processing on the internal code block of the replaced target file to obtain a compressed and confused file;
and filling the compressed and confused file to the corresponding position of each inline code block to obtain a processed target file.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
reading a target file in a front-end project to obtain at least one inline code block in the target file;
replacing each inline code block with a preset placeholder code block to obtain a replaced target file;
carrying out compression and confusion processing on the internal code block of the replaced target file to obtain a compressed and confused file;
and filling the compressed and confused file to the corresponding position of each inline code block to obtain a processed target file.
According to the file processing method, the device, the computer equipment and the storage medium, under the condition that the structure of the target file in the front-end project is not changed, the preset occupied code block is adopted to replace the inline code block in the target file, the intermediate processing file, namely the replaced target file, is generated, the inline code block of the replaced target file is compressed and obfuscated, and then the compressed and obfuscated file is filled to the position of the inline code block in the target file.
Drawings
FIG. 1 is a diagram of an application environment of a file processing method in one embodiment;
FIG. 2 is a flowchart illustrating a method of document processing according to one embodiment;
FIG. 3 is a flowchart illustrating a document processing method according to another embodiment;
FIG. 4 is a flowchart illustrating a document processing method according to another embodiment;
FIG. 5 is a block diagram showing a configuration of a file processing apparatus according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The file processing method provided by the embodiment of the application can be applied to computer equipment shown in fig. 1. The computer device comprises a processor and a memory connected by a system bus, wherein a computer program is stored in the memory, and the steps of the method embodiments described below can be executed when the processor executes the computer program. Optionally, the computer device may further comprise a network interface, a display screen and an input device. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a nonvolatile storage medium storing an operating system and a computer program, and an internal memory. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. Optionally, the computer device may be a server, a personal computer, a personal digital assistant, other terminal devices such as a tablet computer, a mobile phone, and the like, or a cloud or a remote server, and the specific form of the computer device is not limited in the embodiment of the present application.
In one embodiment, as shown in fig. 2, a file processing method is provided, which is described by taking the method as an example applied to the computer device in fig. 1, and includes the following steps:
s201, reading a target file in the front-end project to obtain at least one inline code block in the target file.
In a specific embodiment, the front-end project comprises a web project, and in general, a large amount of html codes in a file of the web project refer to js codes in an inline manner, so that compression and confusion of the js codes are needed to reduce the resource size of the front-end web project and improve the security of the front-end codes. The front-end project is usually a web project, the extension name of the target file is html, or js, css, js and png, and the target file comprises js code blocks, css code blocks and the like; the inline code block in this embodiment may be a js code block. Optionally, in this embodiment, the computer device may sequentially read the target file in the front-end project, read the content of the target file in the form of a file stream into the memory, and process the content of the target file as a character string to obtain at least one inline code block in the target file, that is, the computer device may sequentially read the target file with an extension of html in the front-end project to obtain at least one js code block in the target file.
S202, replacing each inline code block with a preset placeholder code block to obtain a replaced target file.
The preset placeholder code blocks can be placeholders, placeholder characteristic values and the like, and the replacement of the inline code blocks in the target file can be realized. Optionally, the computer device may first obtain the placeholder code blocks with the same number as the number of the inline code blocks in the target file, sequentially replace the inline code blocks in the target file with the placeholder code blocks to obtain the replaced target file, or replace the inline code blocks in the target file with the obtained placeholder code blocks to obtain the replaced target file. It can be understood that other structures of the target file after replacement are not changed, and only the inline code blocks are replaced by the preset placeholder code blocks.
S203, carrying out compression and confusion processing on the internal code blocks of the replaced target file to obtain a compressed and confused file.
The step of compressing the internal code block of the target file after replacement refers to removing comments, excess spaces, simplified identifiers and the like of the internal code block, and the step of obfuscating the internal code block of the target file after replacement refers to making the internal code block difficult to read under the condition of ensuring that the execution result of the internal code block is not damaged, and commonly uses obfuscation rules: split strings, split arrays, add obsolete codes, and so on. Optionally, the computer device may simultaneously perform compression and obfuscation on the internal code block of the target file after replacement, or may perform obfuscation on the internal code block of the target file after replacement before compression.
And S204, filling the compressed and confused file to the corresponding position of each inline code block to obtain a processed target file.
It can be understood that the compressed and obfuscated inline code blocks in the file are subjected to compression obfuscation, the compressed and obfuscated file is filled to the corresponding position of each inline code block in the target file, that is, the compressed and obfuscated inline code blocks are used to replace the inline code blocks in the original target file, and the obtained processed target file is the inline code blocks on which the inline code blocks are subjected to compression obfuscation.
Further, after obtaining at least one inline code block in the target file, the computer device may also flexibly add other task streams for additional processing, such as additionally adding some tasks in the process of processing the character string, optimizing the normalization of the html code, compressing the css code, and the like.
According to the file processing method, under the condition that the structure of the target file in the front-end project is not changed, the preset placeholder code blocks are adopted to replace the inline code blocks in the target file, the intermediate processing file, namely the replaced target file, is generated, the inline code blocks of the replaced target file are compressed and obfuscated, and then the compressed and obfuscated file is filled to the position of the inline code blocks in the target file.
Further, in the scenario that the target file in the front-end item is read to obtain at least one inline code block in the target file, in an embodiment, as shown in fig. 3, the step S201 includes:
s301, reading the content of the target file in a file stream mode to obtain a character string corresponding to the target file.
The target file is a file generated by a corresponding character string, optionally, the file stream may be a character stream or a byte stream, that is, the computer device may read the content of the target file in the form of a character stream to obtain a character string corresponding to the target file, or may read the content of the target file in the form of a byte stream to obtain a character string corresponding to the target file.
S302, searching the character string corresponding to the target file by adopting a character string matching search characteristic mode to obtain at least one inline code block in the target file.
Specifically, under the condition that the computer device obtains the character string corresponding to the target file, the computer device searches the character string corresponding to the target file by adopting a character string matching search characteristic mode to obtain at least one inline code block in the target file. Optionally, in this embodiment, the computer device may perform feature lookup on a character string corresponding to the target file by using a character string matching lookup feature manner, to obtain at least one inline code block in the target file, where the inline code block is a module identified by a script feature, for example, the inline code block may be a module identified by a < script > script feature. It should be noted that the content of the portion in the module identified by the < script > is the portion that needs to be replaced by the preset placeholder code block.
In this embodiment, the computer device can quickly read the content of the target file in the form of a file stream to obtain the character string corresponding to the target file, and the efficiency of obtaining the character string corresponding to the target file is improved.
In the above scenario where the preset placeholder code blocks are used to replace the inline code blocks in the target file to obtain the replaced target file, the placeholder code blocks need to be generated first, and on the basis of the above embodiment, in an embodiment, the step S202 includes: generating an occupancy code block for each inline code block; placeholder code chunks are unique and not duplicative.
Specifically, in order to avoid a replacement error caused by duplicate naming of the placeholder code blocks in the process of replacing the inline code blocks in the target file with the placeholder code blocks, before replacing each inline code block in the target file with a preset placeholder code block to obtain a replaced target file, the computer device may first generate the placeholder code blocks for each inline code block in the target file by using an algorithm, and the generated placeholder code blocks are unique and are not duplicated.
In this embodiment, the computer device generates the placeholder code blocks for the respective inline code blocks in the target file, and the generated placeholder code blocks are unique and not repeated, so that a situation of replacement error caused by repeated naming of the placeholder code blocks in the process of replacing the inline code blocks in the target file with the placeholder code blocks can be avoided, and accuracy of replacing the inline code blocks in the target file with the preset placeholder code blocks is improved.
In the foregoing scenario in which the compressed obfuscated file is obtained by performing the compressed obfuscating process on the inline code block of the replaced target file, on the basis of the foregoing embodiment, in an embodiment, the step S203 includes: and performing compression and confusion processing on the internal code block of the replaced target file by adopting a preset confusion library to obtain a compressed and confused file.
The predetermined obfuscated library may be an uglifyjs compressed obfuscated open source library. Specifically, in this embodiment, the computer device may use an open source library such as an uglifyjs compressed obfuscated library to perform a compressed obfuscation process on the above-mentioned replaced inline code block of the target file, so as to obtain a compressed obfuscated file.
In this embodiment, the computer device performs compression and obfuscation processing on the inline code block of the replaced target file by using the preset obfuscation library, and the reliability of the obtained compression and obfuscation result can be ensured by using the preset obfuscation library, that is, the reliability of the obtained compression and obfuscated file is improved by performing compression and obfuscation processing on the inline code block of the replaced target file by using the preset obfuscation library.
In the foregoing scenario where the compressed and obfuscated file is filled into corresponding positions of each inline code block of the target file to obtain a processed target file, on the basis of the foregoing embodiment, in an embodiment, the foregoing S204 includes: and performing matching backfill according to the file name of the compressed and confused file to obtain the processed target file.
The backfilling refers to a process of replacing each inline code block in the target file by a compressed and confused file. Specifically, in this embodiment, the computer device matches the file name of the compressed and obfuscated file with each inline code block in the target file, and backfills the content of all the compressed and obfuscated files as character strings to the positions of each inline code block in the previous target file, so as to obtain the processed target file.
In this embodiment, the computer device can accurately perform matching backfill according to the file name of the compressed and obfuscated file, so that the compressed and obfuscated file can be accurately filled to the corresponding position of each inline code block in the target file to obtain the processed target file, and the accuracy of the obtained processed target file is improved.
In the above scenario of reading an object file in a front-end item, first, the object file needs to be acquired, and based on the foregoing embodiment, in an embodiment, the method further includes: and acquiring the target file from a preset disk directory according to the directory of the front-end item.
Specifically, in this embodiment, the computer device may scan a root directory of the web project source code as an entry, and search all files ending with the html suffix from a preset disk directory in a recursive manner according to a directory where a front-end project is located, and determine the files as target files.
In this embodiment, the computer device can quickly and accurately acquire the target file from the preset disk directory according to the directory where the front-end item is located, so that the efficiency and accuracy of acquiring the target file by the computer device are improved.
To facilitate understanding by those skilled in the art, the document processing method provided in the present application is described in detail below, and referring to fig. 4, the method may include:
and S1, acquiring the target file from the preset disk directory according to the directory of the front-end item.
And S2, reading the content of the target file in a file stream mode to obtain the character string corresponding to the target file.
S3, performing feature search on the character string corresponding to the target file by adopting a character string matching and feature searching mode to obtain at least one inline code block in the target file; wherein the inline code block is a module identified with < script > characteristics.
S4, generating unique and non-repetitive placeholder code blocks for each inline code block.
And S5, replacing each inline code block with the placeholder code block to obtain a replaced target file.
And S6, performing compression and confusion processing on the internal code blocks of the replaced target file by adopting a preset confusion library to obtain a compressed and confused file.
And S7, performing matching backfill according to the file name of the compressed and confused file, and filling the compressed and confused file to the corresponding position of each inline code block to obtain the processed target file.
It should be noted that, for the descriptions in S1-S7, reference may be made to the descriptions related to the above embodiments, and the effects are similar, and the description of this embodiment is not repeated herein.
It should be understood that although the various steps in the flow charts of fig. 2-4 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-4 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.
In one embodiment, as shown in fig. 5, there is provided a document processing apparatus including: read module, replacement module, first processing module and second processing module, wherein:
and the reading module is used for reading the target file in the front-end project to obtain at least one inline code block in the target file.
And the replacing module is used for replacing each inline code block by adopting a preset position-occupying code block to obtain a replaced target file.
And the first processing module is used for carrying out compression and confusion processing on the internal code block of the replaced target file to obtain a compressed and confused file.
And the second processing module is used for filling the compressed and confused file to the corresponding position of each inline code block to obtain a processed target file.
The file processing apparatus provided in this embodiment may execute the method embodiments described above, and the implementation principle and the technical effect are similar, which are not described herein again.
On the basis of the foregoing embodiment, optionally, the reading module includes: a reading unit and a lookup unit, wherein:
and the reading unit is used for reading the content of the target file in a file stream mode to obtain the character string corresponding to the target file.
And the searching unit is used for searching the character string corresponding to the target file by adopting a character string matching searching characteristic mode to obtain at least one inline code block in the target file.
The file processing apparatus provided in this embodiment may execute the method embodiments described above, and the implementation principle and the technical effect are similar, which are not described herein again.
On the basis of the foregoing embodiment, optionally, the searching unit is configured to perform feature search on a character string corresponding to the target file by using a character string matching search feature mode, so as to obtain at least one inline code block in the target file; the inline code block is a module identified by script features.
The file processing apparatus provided in this embodiment may execute the method embodiments described above, and the implementation principle and the technical effect are similar, which are not described herein again.
On the basis of the foregoing embodiment, optionally, the apparatus further includes: a generation module, wherein:
the generating module is used for generating an occupation code block for each inline code block; placeholder code chunks are unique and not duplicative.
The file processing apparatus provided in this embodiment may execute the method embodiments described above, and the implementation principle and the technical effect are similar, which are not described herein again.
On the basis of the foregoing embodiment, optionally, the first processing module includes: a first processing unit, wherein:
and the first processing unit is used for performing compression and confusion processing on the inline code block of the replaced target file by adopting a preset confusion library to obtain a compressed and confused file.
The file processing apparatus provided in this embodiment may execute the method embodiments described above, and the implementation principle and the technical effect are similar, which are not described herein again.
On the basis of the foregoing embodiment, optionally, the second processing module includes: a second processing unit, wherein:
and the second processing unit is used for carrying out matching backfill according to the file name of the compressed and confused file to obtain a processed target file.
The file processing apparatus provided in this embodiment may execute the method embodiments described above, and the implementation principle and the technical effect are similar, which are not described herein again.
On the basis of the foregoing embodiment, optionally, the apparatus further includes: an acquisition module, wherein:
and the acquisition module is used for acquiring the target file from a preset disk directory according to the directory of the front-end item.
The file processing apparatus provided in this embodiment may execute the method embodiments described above, and the implementation principle and the technical effect are similar, which are not described herein again.
For the specific definition of the document processing device, the above definition of the document processing method can be referred to, and is not repeated herein. The respective modules in the above-described document processing apparatus may be wholly or partially implemented by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
reading a target file in a front-end project to obtain at least one inline code block in the target file;
replacing each inline code block with a preset placeholder code block to obtain a replaced target file;
carrying out compression and confusion processing on the internal code block of the replaced target file to obtain a compressed and confused file;
and filling the compressed and confused file to the corresponding position of each inline code block to obtain a processed target file.
The implementation principle and technical effect of the computer device provided by the above embodiment are similar to those of the above method embodiment, and are not described herein again.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
reading a target file in a front-end project to obtain at least one inline code block in the target file;
replacing each inline code block with a preset placeholder code block to obtain a replaced target file;
carrying out compression and confusion processing on the internal code block of the replaced target file to obtain a compressed and confused file;
and filling the compressed and confused file to the corresponding position of each inline code block to obtain a processed target file.
The implementation principle and technical effect of the computer-readable storage medium provided by the above embodiments are similar to those of the above method embodiments, and are not described herein again.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of file processing, the method comprising:
reading a target file in a front-end project to obtain at least one inline code block in the target file;
replacing each inline code block with a preset placeholder code block to obtain a replaced target file;
carrying out compression and confusion processing on the internal code block of the replaced target file to obtain a compressed and confused file;
and filling the compressed and confused file to the corresponding position of each inline code block to obtain a processed target file.
2. The method of claim 1, wherein reading a target file in a front-end project to obtain at least one inline code block in the target file comprises:
reading the content of the target file in a file stream mode to obtain a character string corresponding to the target file;
and searching the character string corresponding to the target file by adopting a character string matching search characteristic mode to obtain at least one inline code block in the target file.
3. The method according to claim 2, wherein the searching the character string corresponding to the target file by adopting a character string matching search feature manner to obtain at least one inline code block in the target file comprises:
performing characteristic search on the character string corresponding to the target file by adopting a character string matching search characteristic mode to obtain at least one inline code block in the target file; the inline code block is a module identified by script features.
4. The method of claim 1, wherein before replacing each of the inline code blocks with a preset placeholder code block to obtain a replaced target file, the method further comprises:
generating an occupancy code block for each of the inline code blocks; the placeholder code chunks are unique and non-duplicative.
5. The method according to any one of claims 1 to 4, wherein the performing compression obfuscation on the inline code block of the replaced target file to obtain a compressed obfuscated file comprises:
and performing compression and confusion processing on the internal code block of the replaced target file by adopting a preset confusion library to obtain the compressed and confused file.
6. The method according to any one of claims 1 to 4, wherein the filling the compressed and obfuscated file to a corresponding position of each of the inline code blocks to obtain a processed target file comprises:
and performing matching backfill according to the file name of the compressed and confused file to obtain the processed target file.
7. The method of claim 1, further comprising:
and acquiring the target file from a preset disk directory according to the directory of the front-end item.
8. A document processing apparatus, characterized in that the apparatus comprises:
the reading module is used for reading a target file in a front-end project to obtain at least one inline code block in the target file;
the replacing module is used for replacing each inline code block by adopting a preset placeholder code block to obtain a replaced target file;
the first processing module is used for carrying out compression and confusion processing on the internal code block of the replaced target file to obtain a compressed and confused file;
and the second processing module is used for filling the compressed and confused file to the corresponding position of each inline code block to obtain a processed target file.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202111313454.0A 2021-11-08 2021-11-08 File processing method and device, computer equipment and storage medium Pending CN114065703A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111313454.0A CN114065703A (en) 2021-11-08 2021-11-08 File processing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111313454.0A CN114065703A (en) 2021-11-08 2021-11-08 File processing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114065703A true CN114065703A (en) 2022-02-18

Family

ID=80274416

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111313454.0A Pending CN114065703A (en) 2021-11-08 2021-11-08 File processing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114065703A (en)

Similar Documents

Publication Publication Date Title
CN110209652B (en) Data table migration method, device, computer equipment and storage medium
US6324637B1 (en) Apparatus and method for loading objects from a primary memory hash index
CN109032662B (en) Code file generation method and device, computer equipment and storage medium
CN108446363B (en) Data processing method and device of KV engine
CN109684607B (en) JSON data analysis method and device, computer equipment and storage medium
CN111176717B (en) Method and device for generating installation package and electronic equipment
CN110399096B (en) Method, device and equipment for deleting metadata cache of distributed file system again
CN113504918A (en) Equipment tree configuration optimization method and device, computer equipment and storage medium
CN115699584A (en) Compression/decompression using indices relating uncompressed/compressed content
CN113468118B (en) File increment storage method, device and storage medium based on blockchain
CN114065703A (en) File processing method and device, computer equipment and storage medium
CN116680014A (en) Data processing method and device
CN110956195A (en) Image matching method and device, computer equipment and storage medium
CN112596733B (en) Method, device, storage medium and electronic equipment for compiling and acquiring files
CN114238334A (en) Heterogeneous data encoding method and device, heterogeneous data decoding method and device, computer equipment and storage medium
US11222068B2 (en) Information processing device, information processing method, and data structure
CN111538651A (en) Interface testing method, device, server and storage medium
CN111400243A (en) Research and development management system based on pipeline service and file storage method and device
CN111552510A (en) File construction method and device, electronic equipment and computer readable storage medium
CN111399846B (en) Android mobile phone application program capacity monitoring method and device
CN113411395B (en) Access request routing method, device, computer equipment and storage medium
CN111562940B (en) Project data construction method and device
CN112379915A (en) Source code processing method and device
CN116974567A (en) Method, apparatus, device, medium and program product for packaging components of applet
CN113901057A (en) Data playback method and device, computer equipment and storage medium

Legal Events

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