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.
$ npm install node-mac-app-icon --save- getAppIconByPid(pid, opts) ⇒
Promise.<Buffer> Find an icon for a running application (by it's PID)
- getAppIconListByPid(pidArray, opts) ⇒
Promise.<Array.<ListResult>> Find icons for a list of running apps (by their PIDs)
- Options :
Object - ListOptions :
Object - ListResult :
Object
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
});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: ... }
});Kind: global typedef Properties
| Name | Type | Description |
|---|---|---|
| size | number |
Size of output icon (in points) |
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 |
Kind: global typedef Properties
| Name | Type | Description |
|---|---|---|
| pid | number |
PID of the application |
| icon | Buffer |
Buffer containing image data |
This software is licensed under the MIT License