add compress function to compress .toy file