Getting s3 object metadata then creating stream
<p>I'm downloading an object from s3 and creating a read stream object from it to process a video:</p>
<pre><code>s3.getObject(params).createReadStream()
</code></pre>
<p>However, I need to get the metadata from it which is possible when i just get the object by accessing its 'metadata' property:</p>
<pre><code>s3.getObject()
</code></pre>
<p>How would I either:</p>
<ol>
<li><p>Get the object via <code>s3.getObject()</code>, grab the metadata from its metadata property, and then turn it into a read stream?</p>
<p><code>var stream = fs.createReadStream(response);</code> isn't working - input must be a string</p>
</li>
</ol>
<p>-- OR --</p>
<ol start="2">
<li><p>Get the stream via <code>s3.getObject().createReadStream()</code>, and extract the metadata from the stream?</p>
<p>To my knowledge metadata isn't passed within streams.</p>
</li>
</ol>
<hr />
<p>Tell me if my assumptions are wrong, but I am currently stuck with these two needs:</p>
<ul>
<li>Getting the meta data</li>
<li>Making it a stream</li>
</ul>