file-icon
Get the icon of a file or app as a PNG image
Requires macOS 10.10 or later. macOS 10.13 or earlier needs to download the Swift runtime support libraries.
Install
$ npm install file-icon
Usage
API
fileIconToBuffer(input, options?)
Returns a Promise<Buffer>
for a PNG image if input
is of type string
or number
.
Returns a Promise<Buffer[]>
for multiple PNG images if input
is of type Array<string | number>
.
input
Type: string | number | Array<string | number>
Either:
- App name (string)
- App bundle identifier (string)
- App process ID (number)
- Path to an app (string)
- Path to a file (string)
options
Type: object
size
Type: number
Default: 1024
Maximum: 1024
Size of the returned icon.
fileIconToFile(input, options)
Returns a Promise
that resolves when the files are written to options.destination
.
input
Type: string | number | Array<string | number>
options
Type: object
size
Type: number
Default: 1024
Maximum: 1024
Size of the returned icon.
destination
Required
Type: string | string[]
Output file for the icon. If input
is a single value, options.destination
must be of type string
. If input
is an Array
, options.destination
must be of type string[]
with the same length
as input
.
Related
- file-icon-cli - CLI for this module
- app-path - Get the path to an app