title: Getting absolute filepath from Google Cloud Storage for use with pdf-text-extract
body: <p>The package <code>pdf-text-extract</code> requires an absolute filepath. I need to use this package on files in a Google Cloud Storage bucket. </p>
  
  <p>Is there a way to pass a file from a GCS bucket as an absolute URL?</p>
  
  <p>Here is my code (Node.js): </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var storage = require('@google-cloud/storage')();
  const extract = require('pdf-text-extract');
  
  const bucketFile = 'http://bucketname.storage.googleapis.com/fileName.pdf';
  
  extract(bucketFile, 
      (err, pages) =&gt; {
          if (err) {
              console.error(err)
              return
          }
  
          console.log(pages);
      }
  );</code></pre>
  </div>
  </div>
  </p>
  
  <p>This returns an error: </p>
  
  <p><code>Error: pdf-text-extract command failed: I/O Error: Couldn't open file 'D:\Libraries\Documents\pdf-text-extract-bucket\http:\bucketname.storage.googleapis.com\fileName.pdf'</code></p>
  
  <p>I've also tried passing this to the extract function: </p>
  
  <p>file = storage.bucket('bucketname').file('fileName.pdf');</p>
  
  <p>The way it works with local files (instead of GCS buckets): </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const filePath = path.join(__dirname, tempFileName);  
  extract(filePath, callback);</code></pre>
  </div>
  </div>
  </p>