title: Reading file from Azure blob storage using pickle or dill without saving to disk
body: <p>I'm trying to read weights for a machine learning model from Azure Storage Blob in Python. This should be running in Azure Functions, so I don't believe I'm able to use methods which save the blob to disk.</p>
  <p>I'm using azure-storage-blob 12.5.0, not the legacy version.</p>
  <p>I've tried using <em>Dill.loads</em> to load the .pkl file, like so:</p>
  <pre class="lang-python prettyprint-override"><code>connection_string = 'my_connection_string'
  blob_client = BlobClient.from_connection_string(connection_string, container_name, blob_name)
  downloader = blob_client.download_blob(0)
  
  with BytesIO() as f:
      downloader.readinto(f)
      weights = dill.loads(f)
  </code></pre>
  <p>Which returns:</p>
  <pre class="lang-none prettyprint-override"><code>&gt;&gt;&gt; TypeError: a bytes-like object is required, not '_io.BytesIO'
  </code></pre>
  <p>I'm not sure how the approach using Pickle would be. How could this be solved?</p>