Skip to content

一个实现了批量将 protobuf 数据自动识别为类 json 格式,批量将 proto 定义文件转为 python 类的命令行工具。适用于需要转换大量的 protobuf 数据或 proto 定义文件。

License

WankkoRee/protools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

protools GitHub Repo stars GitHub Downloads PyPI Downloads

一个实现了批量将protobuf数据自动识别为json格式,批量将proto定义文件转为python的命令行工具。

适用于需要转换大量的protobuf数据proto定义文件

暂时只在Windows 10 x64Ubuntu 20.04 x64的中文环境下做过测试,其他系统或语言环境如有问题欢迎提交issue。

install

pip install protools

update

GitHub release (latest by date) PyPI

pip install --upgrade protools

use

python -m protools -f ... -i ... -o ...
protools -f ... -i ... -o ...

其中-f可选参数有b2j[buf2json]、p2p[proto2python]。 其中-i是输入文件夹,-o是输出文件夹,其合法关系有一对一多对一多对多,当使用多对多关系时,应确保输入文件夹和输出文件夹一一对应(见demo2)。

demo

  1. datanet文件夹中所有文件当作protobuf数据批量自动识别为json格式并写入到json文件夹。
    protools -f b2j -i data -i net -o json
    screenshot
  2. datanet文件夹中所有文件当作protobuf数据批量自动识别为json格式并分别写入到data_jsonnet_json文件夹。
    protools -f b2j -i data -i net -o data_json -o net_json
    screenshot
  3. proto文件夹中的所有文件当作proto定义文件批量转为python并写入到python文件夹。
    protools -f p2p -i proto -o python
    screenshot

License

GitHub License

About

一个实现了批量将 protobuf 数据自动识别为类 json 格式,批量将 proto 定义文件转为 python 类的命令行工具。适用于需要转换大量的 protobuf 数据或 proto 定义文件。

Topics

Resources

License

Stars

Watchers

Forks

Languages