Find the best app to open a file / thumbnailize it according to XDG Specifications
npm install xdg-apps
var Finder = require("xdg-apps");
var finder = new Finder();
finder.find("/path/to/my/file",function(err,launcher){
//DO SOMETHING
});
//OR
finder.find("/path/to/my/file").then(function(launcher){
//DO SOMETHING
}).catch(function(e){
//ERROR
});
If you want to really open the file afterward, take a look at desktop-launch.
var Finder = require("xdg-apps");
var finder = new Finder();
finder.apps.list().then(function(apps){
//An array of parsed desktop entries
}).catch(function(e){
//Handle errors
})
finder takes only one parameter : the type of apps we want to search for. Possible values :
- desktop for desktop entries (default)
- thumbnailer for thumbnails Specification
Other values wont throw an error but will produce undefined results.