The file contains only bytes. What you think these bytes mean is entirely up to you. Any idea that the file is of a real type is an illusion. For example, you could name it sample.txt, but it was actually a TAR file.
There are tools to guess what file format might be. However, this is just an assumption. A file does not have a "real" file type.
source share