All Projects → sindresorhus → File Icon

sindresorhus / File Icon

Licence: mit
Get the icon of a file or app as a PNG image (macOS)

Programming Languages

javascript
184084 projects - #8 most used programming language
swift
15916 projects

Projects that are alternatives of or similar to File Icon

file-icon-cli
Get the icon of a file or app as a PNG image (macOS)
Stars: ✭ 73 (-27%)
Mutual labels:  png, file, path, icon
Ruby Gem Downloads Badge
Clean and simple gem downloads count badge, courtesy of http://shields.io/. You can checkout the application directly at the following URL:
Stars: ✭ 29 (-71%)
Mutual labels:  image, png, icon
Eager Image Loader
The eager-loading for image files on the web page that loads the files according to your plan. This differs from the lazy-loading, for example, this can be used to avoid that the user waits for the loading.
Stars: ✭ 22 (-78%)
Mutual labels:  image, file
Resolve Dir
Resolve a directory that is either local, global or in the user's home directory.
Stars: ✭ 14 (-86%)
Mutual labels:  path, file
Androidutilcode
AndroidUtilCode 🔥 is a powerful & easy to use library for Android. This library encapsulates the functions that commonly used in Android development which have complete demo and unit test. By using it's encapsulated APIs, you can greatly improve the development efficiency. The program mainly consists of two modules which is utilcode, which is commonly used in development, and subutil which is rarely used in development, but the utils can be beneficial to simplify the main module. 🔥
Stars: ✭ 30,239 (+30139%)
Mutual labels:  app, file
Image Optimizer
Image optimization / compression library. This library is able to optimize png, jpg and gif files in very easy and handy way. It uses optipng, pngquant, pngcrush, pngout, gifsicle, jpegoptim and jpegtran tools.
Stars: ✭ 785 (+685%)
Mutual labels:  image, png
Scrimage
Java, Scala and Kotlin image processing library
Stars: ✭ 792 (+692%)
Mutual labels:  image, png
Repng
React component to PNG converter
Stars: ✭ 856 (+756%)
Mutual labels:  image, png
Icongenerator
🍱 A macOS app to generate app icons
Stars: ✭ 1,144 (+1044%)
Mutual labels:  app, icon
Goscraper
Golang pkg to quickly return a preview of a webpage (title/description/images)
Stars: ✭ 72 (-28%)
Mutual labels:  image, icon
Photok
Encrypted Photo Safe for Android
Stars: ✭ 83 (-17%)
Mutual labels:  image, app
Pixterm
Draw images in your ANSI terminal with true color
Stars: ✭ 782 (+682%)
Mutual labels:  image, png
Flyimg
Dockerized PHP7 application runs as a Microservice to resize and crop images on the fly. Get optimised images with MozJPEG, WebP or PNG using ImageMagick. Includes face detection, cropping, face blurring, image rotation and many other options. Abstract storage based on FlySystem in order to store images on any provider (local, AWS S3...).
Stars: ✭ 762 (+662%)
Mutual labels:  image, png
Exhibit
Exhibit is a managed screensaver App for tvOS.
Stars: ✭ 19 (-81%)
Mutual labels:  image, app
Sakurakit
🤡SakuraKit, a lightweight and powerful library for application to switching themes or skins.
Stars: ✭ 682 (+582%)
Mutual labels:  image, icon
Bbmetalimage
A high performance Swift library for GPU-accelerated image/video processing based on Metal.
Stars: ✭ 677 (+577%)
Mutual labels:  image, png
Angular File Uploader
Angular file uploader is an Angular 2/4/5/6/7/8/9/10 + file uploader module with Real-Time Progress Bar, Responsive design, Angular Universal Compatibility, localization and multiple themes which includes Drag and Drop and much more.
Stars: ✭ 92 (-8%)
Mutual labels:  image, file
Sdwebimage
Asynchronous image downloader with cache support as a UIImageView category
Stars: ✭ 23,928 (+23828%)
Mutual labels:  image, png
Jspaint
🎨 Classic MS Paint, REVIVED + ✨Extras
Stars: ✭ 5,972 (+5872%)
Mutual labels:  image, app
Tiny Site
图片优化
Stars: ✭ 65 (-35%)
Mutual labels:  image, png

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

import fs from 'fs';
import fileIcon from 'file-icon';

// An app name can be used
const buffer = await fileIcon.buffer('Safari');
fs.writeFileSync('safari-icon.png', buffer);

// An array of app names
const apps = ['Finder', 'Safari'];
const buffers = await fileIcon.buffer(apps);
buffers.map((buffer, index) => fs.writeFileSync(`${apps[index]}-icon.png`, buffer));

// Or a bundle ID
const buffer2 = await fileIcon.buffer('com.apple.Safari', {size: 64});
fs.writeFileSync('safari-icon.png', buffer2);

// Or a an array of bundle IDs
const bundleIds = ['com.apple.Finder', 'com.apple.Safari'];
const buffers2 = await fileIcon.buffer(bundleIds);
buffers2.map((buffer, index) => fs.writeFileSync(`${bundleIds[index]}-icon.png`, buffer));

// Or a process ID
const buffer3 = await fileIcon.buffer(257);
fs.writeFileSync('pid.png', buffer3);

// Or an array of process IDs
const pids = [257, 16];
const buffers3 = await fileIcon.buffer(pids, {size: 128});
buffers3.map((buffer, index) => fs.writeFileSync(`${pids[index]}-icon.png`, buffer));

// Or a path to an app / file
const buffer4 = await fileIcon.buffer('/Applications/Safari.app');
fs.writeFileSync('safari-icon.png', buffer4);

// Or an array of filenames
const paths = ['/Applications/Safari.app', '/Applications/Calculator.app'];
const buffers4 = await fileIcon.buffer(paths);
buffers4.map((buffer, index) => fs.writeFileSync(`${paths[index].split(/\/|\./)[2]}-icon.png`, buffer));
fs.writeFileSync('jpeg-file-type-icon.png', buffer4);

// Or a mix of all of them!
await fileIcon.buffer(['Finder', 257, 'com.apple.Calculator', '/Applications/Safari.app']);

// You can also use `fileIcon.file` and provide `options.destination` with the path to write to
await fileIcon.file('Safari', {destination: 'safari-icon.png'});

// You can also use same length arrays for `input` and `options.destination`
await fileIcon.file(['Safari', 'Finder'], {destination: ['safari-icon.png', 'finder-icon.png']});

console.log('Done');

API

fileIcon.buffer(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.

fileIcon.file(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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].