h2non / filetype

Fast, dependency-free Go package to infer binary file types based on the magic numbers header signature
https://pkg.go.dev/github.com/h2non/filetype?tab=doc
MIT License
2.11k stars 175 forks source link

Please add support for CSV & JSON #143

Open apuatcfbd opened 3 months ago

apuatcfbd commented 3 months ago

CSV & JSON are two of the most common file formats when we work with web applications. Unfortunately, the lib doesn't support that. Support for CSV is very much needed.

ivanvanderbyl commented 1 month ago

I needed this as well but realised that it is a very difficult problem. I would suggest first looking at other heuristics such as file extension. Outside of that the only really reliable way to check the file is a library such as magika from Google. Currently only available for Python, Rust, and Node, but is actively being worked on for Go.