SC2 replays are MPQ files, which is a proprietary format created and used by Blizzard. It's an archive that may contain multiple files stored with different compression and optionally encrypted. I wrote a lib to parse MPQ files that embodies SC2Replays:
https://github.com/icza/mpq. I also wrote an SC2 replay parser that is more or less a port of the official s2protocol:
https://github.com/icza/s2prot