Language Detect
Detect the programming language of any file by checking the file name, file extension, file shebang and falling back to a programming language classifier. For more language information, it should be used in conjunction with language-map.
Installation
npm install language-detect --save
Usage
var detect = ;
Asynchronously From a File
;
Synchronously From a File
detect; //=> "JavaScript"
From The Filename and Contents
detect; //=> "JavaScript"
From Only a Filename
detectfilename__dirname + '/test.js'; //=> "JavaScript"
Check for Shebang
detect; //=> "JavaScript"
Run Classification
Uses language-classifier which can only detect a small subset of languages.
detect
Other Properties
- detect.aliases A map of known aliases
- detect.interpreters A map of known interpreters
- detect.extensions A map of known file extensions
- detect.filenames A map of known file names
License
MIT