Way to determine content-type of a file?
BlitzMax Forums/BlitzMax Programming/Way to determine content-type of a file?
| ||
I've used the search function but can't find anything about it. Is there native support in BlitzMax, or maybe through a module, to get the content-type of a file? One that does a decent check, not on extension. Thanks. |
| ||
By parsing the file you mean, or by file-extension, or ? Given the plethora of file formats, either you'd be specifically looking at a minimal set of these you are interested in, or would have access to some mega-library ;-) Image formats for example, one might look to FreeImage, which has some detection functionality built in. |
| ||
No not by file extension :P. Although I could come pretty far with it though, at least for my purposes. I've been looking for an 3rd party library but can't really find anything. I must be looking in the wrong direction I think. |
| ||
This is an Apache licensed Java library for detecting mime types. You could always port it to BlitzMax. Or perhaps there's something similar in C/C++ ? :-) |
| ||
Hmm in that case I think I'll fix up something with using the file-extension. |