title: Adding custom data to a firebase storage upload?
body: <p>I'm uploading files to firebase storage like so:</p>
  
  <pre><code>var storageRef = firebase.storage();
                  var fileRef = storageRef.ref(file.name);
                  fileRef.put(file)
                      .then(function (snapshot) {
                          console.log('Uploaded a blob or file!');
                          window.URL.revokeObjectURL(file.preview);
                      })
  </code></pre>
  
  <p>After the upload I have a firebase storage trigger:</p>
  
  <pre><code>export const processUploadedFile = functions.storage.object().onChange(event =&gt; {
  }
  </code></pre>
  
  <p>What I want to do is upload some additional information with the original upload so that the processUploadedFile knows what to do with it (for example extract the file, move it to a special directory, etc, etc).</p>
  
  <p>I tried using metadata like so:</p>
  
  <pre><code>        var newMetadata = {
              customMetadata: {
                  "Test": "value"
              }
          }
  
  fileRef.put(file, newMetadata)
  </code></pre>
  
  <p>But on the cloud storage trigger function I don't know how to get the metadata, I logged out fileMetaData like so:</p>
  
  <pre><code>file.getMetadata().then((metaData)=&gt;console.log(metaData))
  </code></pre>
  
  <p>But did not see my metadata anywhere in there (or in fileMetaData[0].metadata which returned undefined)</p>
  
  <p>Not sure how I can achieve this...</p>