xdg-thumbnails

2.0.1 • Public • Published

xdg-thumbnails

Generate file thumbnails (image previews) with system workers using freedesktop.org DBus specification

Installation

npm install xdg-thumbnails

Usage

const thumbnailer = new (require('xdg-thumbnails').Thumbnailer);
 
thumbnailer.connect((error) => {
    if (error)
        return console.error(error);
 
    thumbnailer.queueFile('image.jpg', (error, path) => {
        if (error)
            return console.error(error);
 
        console.log(`Newly generated thumbnail: ${path}`);
    });
 
    // or, with options
 
    thumbnailer.queueFile({
        file_path: 'image.jpg',
        scheduler: 'default',  // Options: 'background', 'default', 'foreground'
        flavor:    'normal',   // Options: 'large', 'normal'
    }, (error, path) => {
        if (error)
            return console.error(error);
 
        console.log(`Newly generated thumbnail: ${path}`);
    });
});

Readme

Keywords

none

Package Sidebar

Install

npm i xdg-thumbnails

Weekly Downloads

0

Version

2.0.1

License

GPL-3.0+

Unpacked Size

44.4 kB

Total Files

7

Last publish

Collaborators

  • muchweb