macos-bundle-name
v1.0.0
Published
Retrieve the bundle name from a bundle identifier on macOS.
Downloads
4
Maintainers
Readme
macos-bundle-name
macos-bundle-name is a lightweight utility to retrieve the bundle name from a bundle identifier on macOS.
Installation
You can install this package via npm:
npm install macos-bundle-name
Usage
Here's a quick example of how to use this package:
const getBundleName = require("macos-bundle-name");
const bundleName = getBundleName("com.apple.Safari");
console.log(bundleName); // 'Safari'
const nonExistentBundle = getBundleName("com.nonexistent.Bundle");
console.log(nonExistentBundle); // null
API
getBundleName(bundleIdentifier: string): string | null
Retrieves the bundle name associated with the given bundle identifier.
Parameters
bundleIdentifier
(string): The bundle identifier to look up.
Returns
string | null
: The name of the bundle if found, otherwisenull
.
Example
const getBundleName = require("macos-bundle-name");
const bundleName = getBundleName("com.apple.Safari");
console.log(bundleName); // 'Safari'
const nonExistentBundle = getBundleName("com.nonexistent.Bundle");
console.log(nonExistentBundle); // null
TypeScript
This package includes TypeScript definitions.
import getBundleName from "macos-bundle-name";
const bundleName: string | null = getBundleName("com.apple.Safari");
License
This project is licensed under the MIT License. See the LICENSE file for details.