import struct
import zlib


def compress(filename: str) -> bytes:
    """compress file and return compressed data with original size (4byte) in front
    """
    with open(filename, 'rb') as f:
        content = f.read()
        return struct.pack('<I', len(content)) + zlib.compress(content, level=9)