title: Can I pickle a Zip object?
body: <p>I have a directory containing mostly text and json files, and one binary file (output of <code>MXNet.Block.save_parameters</code> neural network).</p>
  <p>I wanted to zip this folder and then pickle it. Say I have a zip file object:</p>
  <pre class="lang-py prettyprint-override"><code>from zipfile import ZipFile
  import os, pickle, itertools
  
  
  files = list(itertools.chain(*[
      map(lambda x: os.path.join(root, x), files)
      for root, directories, files in os.walk('model-artifacts/')
  ]))
  
  zfile = ZipFile('mymode.l.zip', 'w')
  
  for file in file_paths:
     zfile.write(file)
  </code></pre>
  <p>I cannot really pickle it:</p>
  <pre class="lang-py prettyprint-override"><code>pickle.dumps(zfile)
  
  # TypeError: cannot serialize '_io.BufferedRandom' object
  </code></pre>
  <p>I was wondering if there is a way to pickle zipfiles or any way to pickle contents of a directory.</p>
  <p><strong>WHY?</strong></p>
  <p>I am not doing the pickling myself, but using a library <code>Metaflow</code> which pickles objects in it, so I want to find a way to store my model with <code>Metaflow</code></p>