Hello,

a while ago, I received this feature request for file in private: It was
nice if file(1) could provide the result of several output variants
(--mime, --mime-type, --extensions etc.) in one invocation, and related:
If that output was in a machine-readable format like JSON, so automated
post-processing could be robust against strange strings from libmagic.

Perhaps this would look like

[
    {
        "file_name": "test.jpg",
        "result": [
            # make this an array to support --keep-going
            {
                "magic": "JPEG image data, JFIF standard 1.01, (...)",
                "apple": "8BIMJPEG",
                "extension": "jpeg/jpg/jpe/jfif",
                "mime": "image/jpeg; charset=binary",
                "mime-type": "image/jpeg",
                "mime-encoding": "binary"
            },
            # from --keep-going if set
            {
                "magic": "- JPEG image data, JFIF standard 1.01, resolution (DPI) (...)"
                "apple": "UNKNUNKN",
                "extension":  "???",
                "mime": "application/octet-stream; charset=binary",
                "mime-type": "application/octet-stream",
                "mime-encoding": "binary"
            }    
        }
    },
    {
        "file_name": ...
        ...
    }
]


Looking into the sources, this does not look like an easy task. Of
course a caller could just call file several times - which is what they
currently do -, but it's about performance as well. AIUI, the current
libmagic interface does not support multiple result types, so a new
function was needed to start with. And there is a lot more, like
possibly having six separate output buffers for file_vprintf - but I'll
stop it here as I don't have to tell you about libmagic's internals.

Still, it was something nice to have ...

    Christoph
