pub fn write_header(
    buffer: &mut Vec<u8>
) -> Result<(), Box<dyn Error + Sync + Send>>