osx-fileicon

0.0.2 • Public • Published

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.

Package Sidebar

Install

npm i osx-fileicon

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

4.07 kB

Total Files

5

Last publish

Collaborators

  • blueberryjam