Simple wrapper on top of atom-linguist
npm i hack-linguist
var linguist = require("hack-linguist");
walkIdentify: walks through a directory and identifies each file
identify: Identifies the programming language for a single file
identifySync: Identifies the programming language for a file synchronously
Report
Report is the returned object when using walkIdentifySync It holds some useful data
...
linguist.identify('YOUR_FILE', function(err, language) {
// error -> the possible error that occurred
// language -> the identified language
});
var language = linguist.identify('YOUR_FILE');
...
var report = walkIdentifySync('YOUR_DIRECTORY');
var ignoreList = [
'*.js',
'node_modules',
'bower_components',
'.gitignore',
];
var report = walkIdentifySync('YOUR_DIRECTORY', ignoreList);
Create an asynchronous version of walkIdentifySync