Basically, the files are constructed following certain standards that include some sort of “header” that tells the computer what they are.
Broken down to a basic level, this is like when we two agree on the following for exchanging files:
– Whenever a file starts with “00”, it’s a text file
– when it starts with “01”, it’s a video
– when it starts with “10”, it’s an image
– when it starts with “11”, something went wrong and that’s not a valid file
In practice, these headers are much longer or course, and pass much more info such as the version of some format used, the encoding for text files (=which bit string corresponds to which symbol), stuff like the resolution and framerate for videos, the filesize and so on.
A common approach to passing the file type specifically is for example the extension: we agree on some filename passed in the header, and whatever is the part of the name after the last period specifies the file type.
Latest Answers