compress and uncompress resource