Skip to main content

NodeUtils

Import :

const NodeUtils = brackets.getModule("utils/NodeUtils")

isNodeReady ⇒ boolean

checks if Node connector is ready

Kind: global variable
Returns: boolean - returns true if it's ready, otherwise false

Strings

Generic node util APIs connector. see src-node/utils.js for node peer

Kind: global constant

fetchURLText(url, encoding) ⇒ Promise.<string>

Fetches text content from a URL This is only available in the native app

Kind: global function

ParamType
urlstring
encodingstring

getPhoenixBinaryVersion() ⇒ Promise.<string>

Gets the version of the Phoenix binary This is only available in the native app

Kind: global function

getLinuxOSFlavorName() ⇒ Promise.<(string|null)>

Retrieves the Linux OS flavor name This is only available in the native app on Linux

Kind: global function

openUrlInBrowser(url, browserName)

Opens a URL in the default browser. This is only available in the native app.

Kind: global function

ParamType
urlstring
browserNamestring

getEnvironmentVariable(varName) ⇒ Promise.<string>

Gets an environment variable's value This is only available in the native app

Kind: global function

ParamType
varNamestring

ESLintFile(text, fullFilePath, projectFullPath)

Runs ESLint on a file This is only available in the native app

Kind: global function

ParamType
textstring
fullFilePathstring
projectFullPathstring

openNativeTerminal(cwd, [usePowerShell])

Runs ESLint on a file This is only available in the native app

Kind: global function

ParamTypeDefaultDescription
cwdstringthe working directory of terminal
[usePowerShell]booleanfalse

openInDefaultApp(fullPath) ⇒ Promise.<void>

Opens a file in the default application for its type on Windows, macOS, and Linux.

Kind: global function
Returns: Promise.<void> - - Resolves if the file/folder is opened successfully, rejects otherwise.

ParamTypeDescription
fullPathstringThe path to the file/folder to open.

getDeviceID() ⇒ Promise.<(string|null)>

gets the os device id. this usually won't change till os reinstall.

Kind: global function
Returns: Promise.<(string|null)> - - Resolves with the os identifier or null
Throws:

  • Error - If called from the browser

addDeviceLicenseSystemWide() ⇒ Promise.<boolean>

Enables device license by creating a system-wide license file. On Windows, macOS, and Linux this will request elevation if needed.

Kind: global function
Returns: Promise.<boolean> - - Resolves true if system wide defile file added, else false.
Throws:

  • Error - If called from the browser

removeDeviceLicenseSystemWide() ⇒ Promise.<boolean>

Removes the system-wide device license file. On Windows, macOS, and Linux this will request elevation if needed.

Kind: global function
Returns: Promise.<boolean> - - Resolves true if system wide defile file removed, else false.
Throws:

  • Error - If called from the browser

isLicensedDeviceSystemWide() ⇒ Promise.<boolean>

Checks if the current machine is configured to check for system-wide device license for all users at app start. This validates that the system-wide license file exists, contains valid JSON, and has licensedDevice: true.

Kind: global function
Returns: Promise.<boolean> - - Resolves with true if the device is licensed, false otherwise.

getOSUserName() ⇒ Promise.<string>

Retrieves the operating system username of the current user. This method is only available in native apps.

Kind: global function
Returns: Promise.<string> - A promise that resolves to the OS username of the current user.
Throws:

  • Error Throws an error if called in a browser environment.

getSystemSettingsDir() ⇒ Promise.<string>

Retrieves the directory path for system settings. This method is applicable to native apps only.

Kind: global function
Returns: Promise.<string> - A promise that resolves to the path of the system settings directory.
Throws:

  • Error If the method is called in browser app.