npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@todesktop/plugin-get-app-icon

v0.5.0

Published

Retrieve the icon of a file or app.

Readme

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