Description
file-icon is a macOS library that returns the icon of a file or app as a PNG image. You can pass it an app name, bundle identifier, process ID or path to an app or file, and it returns the icon as a PNG buffer or writes it to a file you choose. It accepts a single input or an array of inputs for several icons at once. The size option sets the output width and height, with a default and maximum of 1024 pixels. The package requires macOS 10.10 or later, and on macOS 10.13 or earlier it needs the Swift runtime support libraries downloaded separately. The project also links to file-icon-cli, a command-line version of the same module, and to app-path, which finds the path of an app. The source is public on GitHub.…
Highlights
- Get file and app icons as PNG
- Accepts app names, bundle IDs, PIDs or paths
- Batch several icons in one call
- Size option up to 1024 pixels
- Command-line companion package
Ratings & Reviews
No ratings yet
Be the first to rate file-icon.
People also visit
file-icon FAQ
What does file-icon do?
It returns the icon of a file or application as a PNG image, either as a buffer or written to a file.
Which macOS versions does it support?
macOS 10.10 or later. On macOS 10.13 or earlier, the Swift runtime support libraries must be downloaded separately.
What sizes can I get?
The size option sets the icon size. The default and the maximum are both 1024 pixels.
Can I get several icons at once?
Yes. Pass an array of inputs. With fileIconToFile you pass an array of destinations of the same length.
Is there a command-line version?
Yes. The README links to file-icon-cli, a CLI for this module.
What are the best file-icon alternatives?
Popular alternatives to file-icon include png2icons, file-icons-js and @wkovacs64/add-icon. See all file-icon alternatives









