0.0.2 • Published 4 years ago

osx-fileicon v0.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

macIconForFile npm version

Get the native macOS icon for a specific file extension as a PNG image buffer.

Inspired and based on:

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.