In JavaScript on the browser, how can I parse text from a file based on mime type? I don't need 100% perfection (I'm not even sure what that would mean in general), just something that's reasonably good enough.
E.g, for a text/plain file, return the full contents, for text/xml or application/json return the field values or lines of key: value, or any other plausible text. Similarly for text/html.
It would be amazing if it could also parse text from binary files (zip, tar, pdf, xlsx, docx, etc.) but that's well beyond the minimum that I'm looking for now.