title: Getting file type in Blob Storage bound Azure Function
body: <p>I'm creating an Azure Function that is bound to my Azure Blob Storage container and triggers whenever a file is uploaded.</p>
  <p>This particular container could have any type of file/blob in it e.g. image, PDF, Excel, MP4, etc.</p>
  <p>I want to create different handlers that will do something depending on uploaded file type. For example, if it's an image file, I want to get its dimensions. If it's an MP4, I want to call another service to process the video, etc.</p>
  <p>How do I get the file type from <code>Stream</code>? It's important to note that I cannot rely on file extension as in some cases, the extension may not be there. Is there a way for me to get the <code>mimetype</code>?</p>
  <p>This is the standard <code>BlogTrigger</code> Azure Function code:</p>
  <pre><code>[FunctionName(&quot;FileManager&quot;)]
  public static void Run([BlobTrigger(&quot;my-container/{name}&quot;, Connection = &quot;myConnectionString&quot;)]Stream myBlob, string name, ILogger log)
  {
      log.LogInformation($&quot;C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes&quot;);
  }
  </code></pre>