Compressing Messages

CXIO messages can be easily compressed or written to an archive format. This can be achieved using the pack directive as explained within this guide.

In the example below, the info command object would be written as JSON and compressed using deflate compression.

info test
     
     hello: "world"

     into disk
         
          path "c:\cxio\test.cxio.deflate"
          
          type json
          
          pack deflate
                   
     ends

ends                  

Creating Archives

Message content can be split into individual entries within a single compressed archive file.

In the example below, we have specified the pack as zip with the output archive name as "petstore.zip". Against the two message bodies, we have specified the individual filenames to be used within within the archive.

info petstore
   
     from petsandco
        
     body name "cat.cxio"     
          pet: "cat"
          sound: "meow"
     ends

     body name "dog.cxio"    
          pet: "dog"
          sound: "woof"
     ends

     into disk
         
          path "c:\cxio\petstore.zip"
          
          type json
          
          pack zip
          
          chop body
                   
     ends

ends