Comment

Comment by xkcd-sucks

Somewhat related, the question of "what IS a file's 'type' really" is pretty messy and AFAIK doesn't have any satisfying solution or any satisfying single answer [0]. A satisfying solution might look like a (long) feature vector. Libmagic goes in the right direction at least although the binary-fingerprint-at-the-beginning approach doesn't work well for everything / past some level of detail

[0] where different use cases might be satisfied by e.g.

    "a text file" 
    "a file exclusively comprised of alphanumeric UTF16 characters" 
    "a CSV file"
    "a file with tabular data and key-value metadata that calls itself CSV but is not spec-compliant so internally we'll call it CSVprime"
    "A file with tabular data written as ASCII text that represents $this_kind_of_measurement"
    ... etc
If you have any resources on this topic off the top of your head I'd appreciate it if you shared them
parent xkcd-sucks 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton