0.1.1 • Published 4 months ago

open-with-applications v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

open-with-applications

open-with-applications is a Node.js package designed to help you find applications that can open a given file on macOS. It leverages macOS's mdls and mdfind commands, as well as the CoreServices and CoreFoundation frameworks, to determine the appropriate apps that support a specific file type.

Features

  • Determine the UTI (Uniform Type Identifier) for a file.
  • Find applications that can open a file based on its UTI.
  • Retrieve detailed information about the applications, including the app name, path, and icon.
  • Designed for macOS and supports .app bundle-based applications.

Installation

npm install open-with-applications

Usage

Example

To find the applications that can open a specific file, you can use the getApplications function. The function accepts the file path and returns a list of applications that can open the file.

import { Mac } from 'open-with-applications';

const filePath = '/path/to/your/file.txt';

const applications = Mac.getApplications(filePath);
console.log(applications);

Example Output

[
  {
    name: 'TextEdit',
    path: '/Applications/TextEdit.app',
    iconPath: '/Applications/TextEdit.app/Contents/Resources/TextEdit.icns',
  },
  {
    name: 'Sublime Text',
    path: '/Applications/Sublime Text.app',
    iconPath: '/Applications/Sublime Text.app/Contents/Resources/Sublime Text.icns',
  }
]
0.1.1

4 months ago

0.1.0

4 months ago