title: Writing a BytesIO object to a file, 'efficiently'
body: <p>So a quick way to write a BytesIO object to a file would be to just use:</p>
  
  <pre><code>with open('myfile.ext', 'wb') as f:
      f.write(myBytesIOObj.getvalue())
  myBytesIOObj.close()
  </code></pre>
  
  <p>However, if I wanted to iterate over the myBytesIOObj as opposed to writing it in one chunk, how would I go about it? I'm on Python 2.7.1. Also, if the BytesIO is huge, would it be a more efficient way of writing by iteration?</p>
  
  <p>Thanks</p>