language-detect

Detect the programming language of any file.

Language Detect

Detect the programming language of any file by checking the file name, file extension, file shebang and finally falling back to a programming language classifier. For more language information, use in conjuction with language-map.

npm install language-detect --save
var detect = require('language-detect');
 
detect(__dirname + '/test.js', function (errlanguage) {
  console.log(err);      //=> null 
  console.log(language); //=> "JavaScript" 
});

MIT