问题描述
我找不到这个问题的答案似乎很奇怪,但是在文件中存储序列化的 protobuf 输出时应该使用什么文件扩展名?只是.protobuf?与我正在谈论的 json 等效的是一个 .json 文件.
Seems odd that I can't find the answer to this, but what file extension are you supposed to use when storing serialized protobuf output in a file? Just .protobuf? The json equivalent of what I am talking about would be a .json file.
推荐答案
我只使用 .bin,但这里没有实际的标准 AFAIK.如果 protoc -o
(以 protobuf 二进制格式作为 FileDescriptorSet
发出一个 .proto 模式)像所有其他输出选项一样采用一个目录,我们可以使用它作为事实上的答案,但 protoc -o
不寻常,因为它需要一个文件.在 protobuf 组的一篇旧帖子中,Kenton Varda(原作者之一)建议文件扩展名应该是特定于实现的(意思是:你决定)而不是简单地指代格式:https://groups.google.com/forum/#!topic/protobuf/JWZx9n8CUvw一个>
I just use .bin, but there's no actual standard here AFAIK. If protoc -o
(which emits a .proto schema in protobuf binary format as a FileDescriptorSet
) had taken a directory like all the other output options do, we could have used that as a de-facto answer, but protoc -o
is unusual in that it takes a file instead. In an old post on the protobuf group, Kenton Varda (one of the original authors) suggests that the file extension should be implementation specific (meaning: you decide) rather than simply referring to the format: https://groups.google.com/forum/#!topic/protobuf/JWZx9n8CUvw
这篇关于序列化 protobuf 输出的文件扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!