title: Nodejs, to get file type of a file
body: <p>The six-year-old question "<a href="https://stackoverflow.com/questions/10431845/">Node.js - File System get file type, solution around year 2012</a>" has a better answer but the outdated answer was the correct one by then.</p>
  
  <p>Hence the question, for an up-to-date solution. </p>