tree_magic
tree_magic copied to clipboard
Detecting application/json
Currently JSON files do not seem to be detected properly, but instead detected as application/json. Is this planned, or out of scope?
I assume you're wanting it detected as text/json or the sort. It seems from reading around (see http://stackoverflow.com/q/477816) that application/json is the way to go for json filetypes. If you want to compare against something else, you should be able to use the match_* functions which should handle aliases like text/json or the like.
Uh, sorry, yeah, I meant to write text/plain. And yes, application/json would be correct.
There are also others, e.g. YAML files are usually specified as text/yaml.
Alright, got you. I just haven't gotten around to implementing that yet. Will soon, but I'm busy with schoolwork right now.
There is also the problem that any valid json file is also a valid yaml and a valid toml file.
For many textual formats there is no good way to differentiate them except heuristics. (like any php .init is a differen but similar format as py .property files which can be equivalent to an toml file)