National Pizza Magistrate

    cf-prefs
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0 • Public • Published

    MIT license PRs Welcome Actions Status

    cf-prefs

    $ yarn add cf-prefs

    This native Node.js module allows you to read managed app preferences on macOS. It maps to the underlying CFPreferencesCopyAppValue family of APIs. This module only truly works in apps with valid bundle IDs (i.e. Electron apps).

    API

    prefs.getPreferenceValue(key, type)

    • key String - The preference key to fetch the value of, has to be a valid UTF-8 string.
    • type String - The data-type of the preference you are fetching. Can be one of string, integer or boolean.
    • defaultValue String | Integer | Boolean (Optional) - If no value is present this value will be returned instead, if no default value is provided this method may return undefined.

    Returns String | Integer | Boolean | undefined - Depending on the requested type, see the type definitions for a more accurate mapping.

    Notes:

    • If the preference is available but in a different type you will not receive an error, you will receive undefined.
    • If the preference is not available you will receive undefined.

    Example:

    console.log('Preference Value:', prefs.getPreferenceValue('MyAppsCoolPreference', 'string', 'this-is-the-default'))

    permissions.isPreferenceForced(key)

    • key String - The preference key to determine if the value is forced, has to be a valid UTF-8 string.

    Returns Boolean - Whether the preference key is "forced", if this method returns true you should not allow users to override this preference in your application as a system administrator has indicated this preference key is "forced". For more information check out the apple API docs.

    Install

    npm i cf-prefs

    DownloadsWeekly Downloads

    575

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    10.8 kB

    Total Files

    7

    Last publish

    Collaborators

    • marshallofsound