There is at least one way to know the size without opening the file and that is when your system and you yourself keep meta information about every file. Then you only need to read the metadata and not the actual file.