New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@todesktop/plugin-get-app-icon

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@todesktop/plugin-get-app-icon

Retrieve the icon of a file or app.

latest
Source
npmnpm
Version
0.5.0
Version published
Maintainers
3
Created
Source

ToDesktop Get App Icon

Retrieve the icon of a file or app.

Installation

Install @todesktop/client-get-app-icon in your client-side application using

npm install @todesktop/client-get-app-icon

Installation of the plugin package is also necessary. Using ToDesktop Builder, navigate to Plugins. Click on the Explore button for "Get App Icon" and install the package.

Usage

extractIcon

Get the icon of a file or app as a PNG image.

Extract icon by file path

import { extractIcon } from "@todesktop/client-get-app-icon";

(async () => {
  const icon = await extractIcon("/Applications/ToDesktop Builder.app");
  console.log(icon);
  // data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKsAAADV.....
})();

Extract icon by process ID (PID)

import { extractIcon } from "@todesktop/client-get-app-icon";

(async () => {
  const icon = await extractIcon({ pid: 12345 });
  console.log(icon);
  // data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKsAAADV.....
})();

API

extractIcon(input)

Parameters:

  • input - Either:
    • string - Path to the file or app (e.g., /Applications/App.app on macOS or C:\Program Files\App\app.exe on Windows)
    • { pid: number } - Object with a pid property specifying the process ID

Returns:

  • Promise<string> - A data URL containing the PNG image of the icon

Notes:

  • When using PID on macOS, the function automatically extracts the .app bundle path from the process executable
  • When using PID, the process must be owned by the current user (unless running with elevated privileges)
  • Throws an error if the process is not found or the path is inaccessible

Changelog

[0.5.0] - 2025-11-27

Added

  • Support for extracting icons by process ID (PID) using extractIcon({ pid: number })
  • Cross-platform PID resolution (macOS and Windows)
  • Automatic .app bundle path extraction on macOS when using PID
  • Comprehensive error handling for missing or inaccessible processes

Changed

  • extractIcon now accepts either a string path or an object with a pid property
  • Updated TypeScript types to reflect the new API signature

FAQs

Package last updated on 27 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts