title: How to read non-text file stored on Google Cloud Storage from Google Cloud Functions
body: <p>I need to read a file from Google Cloud Functions. The file I want to read is hosted in Google Cloud Storage. The file is not a text file which prevents me from using things like <code>download_as_string</code>.</p>
  
  <p>So far, I have tried reading directly from the object in all of the standard ways <code>gcs.open(file)</code>, however gcs was not defined (even though I did import cloudstorage as gcs at the top of the file).</p>
  
  <p>The closest thing I could find was <a href="https://stackoverflow.com/questions/53490557/how-to-read-mp3-data-from-google-cloud-using-python">how to read mp3 data from google cloud using python</a> (I would like to read an MP4 file) but then I tried that, with <code>blob_uri = gf.open(r'gs://' + bucket_name + '/' + file_name)</code> I always get the following error <code>FileNotFoundError: [Errno 2] No such file or directory: gs://&lt;yourbucket&gt;/&lt;filename&gt;</code></p>
  
  <p>I have also tried <code>bucket.get_blob(data['name'])</code>, and <code>bucket.get_blob(data)</code>.</p>
  
  <p>Because it is an mp3 file, I cannot open it as a string (such as <code>file = blobfile.download_as_string()</code>)</p>
  
  <p>I ahve also tried using requests to attempt to convert the file to bitrate and then read that data however, having to create a new file to open the already existing file was not working correctly due to the Read-Only access Cloud functions requires (I also tried directly uploading to Cloud Storage however because CS returns a blog, I was not able to write to the file). </p>
  
  <p>Is it possible to read directly from the (non-text) file hosted directly on Google Cloud Storage from Google Cloud Functions? If so, how would I do this?</p>