Fabric命令手册

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

configtxlator proto_encode

将一个JSON文档转换为protobuf格式数据。

使用方法

~$ configtxlator proto_encode --type=TYPE [<flags>]

命令标志:

  --help                Show context-sensitive help (also try --help-long and
                        --help-man).
  --type=TYPE           The type of protobuf structure to encode to. For
                        example, 'common.Config'.
  --input=/dev/stdin    A file containing the JSON document.
  --output=/dev/stdout  A file to write the output to.

示例代码

下面的示例将控制台输入的json格式的policy,转换为protobuf格式并存入文件policy.pb:

~$ configtxlator proto_encode --type common.Policy --output policy.pb

在启动rest服务后,下面的示例使用curl命令通过rest api执行同样的操作:

~$ curl -X POST --data-binary /dev/stdin "${CONFIGTXLATOR_URL}/protolator/encode/common.Policy" > policy.pb