This is a bit old, but I can think of two ways to implement it. Both use BSD's 'file' tool (man file).

The first way would be to make "file as a service" and host it somewhere. The second way would be to try and get file running with emscripten, which would be bloaty and complicated, but likely to work.

This could probably be extended to "what is this file" with either of these solutions.
posted by SirCmpwn 3 years and 2 months ago Link