0.0.1 • Published 21 days ago

lwtlab-node-mac-app-icon v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
21 days ago

node-mac-app-icon

Build Status

Get App icons by pid on macOS in NodeJS. Returns a Buffer representation of the App's icon data.

The node source uses a Swift binary to fetch the icons so it's pretty fast.

Returning a Buffer is inspired by sindresorhus/file-icon.

Install

$ npm install node-mac-app-icon --save

Functions

Typedefs

getAppIconByPid(pid, opts) ⇒ Promise.<Buffer>

Find an icon for a running application (by it's PID)

Kind: global function Returns: Promise.<Buffer> - Buffer containing image data

ParamTypeDescription
pidnumberApp PID (Process ID)
optsListOptions

Example

const { getAppIconByPid } = require('node-mac-app-icon');

getAppIconByPid(814, { size: 32 }).then(res => {
  console.log(res); // res is a Buffer
});

getAppIconListByPid(pidArray, opts) ⇒ Promise.<Array.<ListResult>>

Find icons for a list of running apps (by their PIDs)

Kind: global function Returns: Promise.<Array.<ListResult>> - Buffer containing image data

ParamTypeDescription
pidArrayArray.<number>App PID (Process ID)
optsOptions

Example

const { getAppIconListByPid } = require('node-mac-app-icon');

getAppIconListByPid([814, 20134, 503], { size: 512 }).then(res => {
  console.log(res); // array of { pid: ..., icon: ... }
});

Options : Object

Kind: global typedef Properties

NameTypeDescription
sizenumberSize of output icon (in points)

ListOptions : Object

Kind: global typedef Properties

NameTypeDescription
sizenumberSize of output icon (in points)
failOnErrorbooleanFail hard if a pid in the list was not found

ListResult : Object

Kind: global typedef Properties

NameTypeDescription
pidnumberPID of the application
iconBufferBuffer containing image data

License

This software is licensed under the MIT License

0.0.1

21 days ago