Added support for the encoding key in write_files

Supported encodings are base64, gzip, and base64 encoded gzip