Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/holusion/node-xdg-apps

Find the best app to open a file / thumbnailize it according to XDG Specifications
https://github.com/holusion/node-xdg-apps

Last synced: 29 days ago
JSON representation

Find the best app to open a file / thumbnailize it according to XDG Specifications

Awesome Lists containing this project

README

        

# node-xdg-apps

![](https://github.com/Holusion/node-xdg-apps/workflows/test/badge.svg)

Find the best app to open a file / thumbnailize it according to XDG Specifications

npm install xdg-apps

## Usage

### Find the right app to open a file
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](https://github.com/Holusion/node-desktop-launch).

### Find a list of system apps

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
})

## Options

finder takes only one parameter : the type of apps we want to search for. Possible values :

- desktop for [desktop entries](http://standards.freedesktop.org/desktop-entry-spec/latest/) **(default)**
- thumbnailer for [thumbnails Specification](http://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html)

Other values wont throw an error but will produce undefined results.