That's the point: a directory is a directory, and the directory contents, when you list them in IPFS, will tell you the file names & file extensions and therefore the file types. That's also how it'll be if you export the directory to your default file system. So if you have a single file, it's best to put it in a directory, when adding it to the IPFS, i.e. "wrapping" it with the
-w option. If you don't do that you might still have some luck with
ipfs cat <hash> and piping that to the
file command. But that doesn't work with all file types. And you'll definitely won't know the original filename.