osx-fileicon
v0.0.2
Published
Get the Finder icon for a file path
Downloads
4
Maintainers
Readme
macIconForFile
Get the native macOS icon for a specific file extension as a PNG image buffer.
Inspired and based on:
- https://github.com/angrycoding/macIconForFile
Retrieves icon, exactly the same way as Finder does it, including QuickLook preview generation in case if it's possible. This is a ultra-stripped re-implementation of the above repo replacing deprecated code
Installation
npm install mac-file-icon
Usage
var getIconForFile = require("osx-fileicon");
getIconForFile("/Users/", function (buffer) {
console.info(buffer);
});
You can always convert Buffer into its base64 representation:
var getIconForFile = require("mac-file-icon");
getIconForFile("/Users/", function (buffer) {
console.info(buffer.toString("base64"));
});
By default, icon size is set to 500x500 for previewing.