Skip to content

Convert one file to another result file according to certain rules without paying attention to file read and write operations.

Notifications You must be signed in to change notification settings

Joezeo/file-dumper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

file-dumper

In the work, there are a lot of requirements to convert one file into another. File-dumper separates the file reading and writing operations, so that you can only focus on the processing logic.

Directories

wireshark-dumper
| --  dumps       where you put the dump files
| --  result     the result file is created in here
| --  parsers    create parser classes here
| --  common     some common components

Usage

Create parser extend common.base_parser.BaseParser, and this parser class should have a method called parse(filename, file) -> str to process the dump file and return the process result which automatically saving in a result file with the same name with dump file. This class should also have the attribute called focus(type of array) to specify the files to be processed. Just like this:

class DemoParser(BaseParser):

    '''
    What's the dump files should this parser deal with
    '''

    foucs = [
        "demo.json"
    ]

    '''
    Every parser should add this method to process dump file content

    @param: filename: current processing file's name
    @param: file: current processing file's content
    '''

    def parse(self, filename, file) -> str:
        content = "";
        # there is your customize process logic
        return content

Run

The program entry was start.py, just python it.

About

Convert one file to another result file according to certain rules without paying attention to file read and write operations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages