lwtlab-node-mac-app-icon
v0.0.1
Published
Get App icons by pid on macOS in NodeJS
Downloads
3
Readme
node-mac-app-icon
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
| Param | Type | Description | | --- | --- | --- | | pid | number | App PID (Process ID) | | opts | ListOptions | |
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
| Param | Type | Description | | --- | --- | --- | | pidArray | Array.<number> | App PID (Process ID) | | opts | Options | |
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
| Name | Type | Description | | --- | --- | --- | | size | number | Size of output icon (in points) |
ListOptions : Object
Kind: global typedef Properties
| Name | Type | Description | | --- | --- | --- | | size | number | Size of output icon (in points) | | failOnError | boolean | Fail hard if a pid in the list was not found |
ListResult : Object
Kind: global typedef Properties
| Name | Type | Description | | --- | --- | --- | | pid | number | PID of the application | | icon | Buffer | Buffer containing image data |
License
This software is licensed under the MIT License