https://github.com/joezeo/file-dumper
Convert one file to another result file according to certain rules without paying attention to file read and write operations.
https://github.com/joezeo/file-dumper
file-dumper file-processor python3
Last synced: 2 months ago
JSON representation
Convert one file to another result file according to certain rules without paying attention to file read and write operations.
- Host: GitHub
- URL: https://github.com/joezeo/file-dumper
- Owner: Joezeo
- Created: 2022-07-16T06:27:38.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-09T09:55:05.000Z (almost 3 years ago)
- Last Synced: 2025-04-13T12:57:49.556Z (2 months ago)
- Topics: file-dumper, file-processor, python3
- Language: Python
- Homepage:
- Size: 95.7 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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:
```python
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.