I've searched to find the proper MIME type for flatbuffers but I can't seem to find any. No mention of it on their documentation either.
The project page: https://github.com/google/flatbuffers
FlatBuffers is an efficient cross platform serialization library for C++, C#, C, Go, Java, Kotlin, JavaScript, Lobster, Lua, TypeScript, PHP, Python, Rust and Swift. It was originally created at Google for game development and other performance-critical applications.
FlatBuffers is a statically typed system, meaning the user of a buffer needs to know what kind of buffer it is. FlatBuffers can of course be wrapped inside other containers where needed, or you can use its union feature to dynamically identify multiple possible sub-objects stored.
FlatBuffers supports both reading and writing FlatBuffers in C++. To use FlatBuffers in your code, first generate the C++ classes from your schema with the --cpp option to flatc . Then you can include both FlatBuffers and the generated code to read or write FlatBuffers.
There is a similar question for protocol buffers, with a useful answer here: https://stackoverflow.com/a/48051331/761177
For flatbuffers something like application/x-flatbuffers;schema=x.y.z might be appropriate, where x.y.z is the namespace declared in your schema.
There is none. The correct mime type to use is application/octet-stream
.
I don't think creating one would make sense either, since a naked FlatBuffer (without knowledge of its schema) cannot be parsed (unlike JSON), it is an opaque binary file. application/flatbuffer
(if it existed) is barely more useful than application/octet-stream
.
You need the schema before the file becomes readable, and I don't think mime types have a way to specify the schema name.. though I suppose flatbuffers/schema-name
would be cool, if whatever standards body governs mime types would allow it :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With