fileType file type checks for the browser and node.js var fileType = require("@nathanfaucett/file_type"); fileType(someFileBuffer); // returns type, ie "json" "html" etc...