app
Retrieve Eagle application attributes like version, architecture, and language.
Here are common attributes for the app:
console.log(eagle.app.version); // Eagle version
console.log(eagle.app.build); // Eagle Build number
console.log(eagle.app.locale); // Application interface language, en/zh_CN/zh_TW/ja_JP
console.log(eagle.app.arch); // x86 | x64
console.log(eagle.app.platform); // darwin | win32
console.log(eagle.app.isWindows); // true | false, whether the operating system is Windows
console.log(eagle.app.isMac); // true | false, whether the operating system is Mac
console.log(eagle.app.runningUnderARM64Translation); // Whether it is running in rosetta translation modeMethods
isDarkColors()
Check if the current system is in dark (Dark) mode.
Returns
boolean- Whether the current system is in Dark mode.
eagle.app.isDarkColors(); // true | falsegetPath(name)
You can request the following paths by name:
namestring - You can request the following paths by name:home- User's home folder (main directory)appData- Application data directory for each user, defaults to:userData- Folder for storing your application configuration files, default is the appData folder plus the application's name. User data files should be written here by convention, but it is not recommended to write large files, as some environments will back up this directory to cloud storage.temp- Temporary folderexe- Current executable filedesktop- Current user's desktop folderdocuments- Path of the user's documents directorydownloads- Path of the user's download directorymusic- Path of the user's music directorypictures- Path of the user's picture directoryvideos- Path of the user's video directoryrecent- Directory of the user's recent files (Windows only).
Returns
Promise<path: string>-pathquery path result.
await eagle.app.getPath('appData'); // 'C:\Users\User\AppData\Roaming'
await eagle.app.getPath('pictures'); // 'C:\Users\User\Pictures'
await eagle.app.getPath('desktop'); // 'C:\Users\User\Desktop'getFileIcon(path[, options])
Get the icon associated with the specified path file.
pathstring - File path for which you want to get the iconoptionsObject (optional)sizestringsmall- 16x16normal- 32x32large- 32x32 onWindows, not supported onmacOS.
Returns
Promise<img: NativeImage>imgNativeImage - A NativeImage type application icon.
let img = await eagle.app.getFileIcon('path_to_file', { size: 'small' });
// Get image information
let base64 = img.toDataURL();
let size = img.getSize(); // {'width': 16, height: 16}
// Save to computer
let buffer = img.toPNG();
require('fs').writeFileSync('output_path/example.png', buffer);createThumbnailFromPath(path, maxSize)
Get the icon associated with the file at the specified path.
pathstring - The file path to get the thumbnail frommaxSizeSize - The maximum width and height (positive number) of the returned thumbnail. On Windows platform, maxSize.height will be ignored and height will be scaled according to maxSize.widthReturns
Promise<img: NativeImage>imgNativeImage - The thumbnail preview image of the file.
let img = await eagle.app.createThumbnailFromPath('path_to_file', {
height: 200,
width: 200
});
// Obtain image information
let base64 = img.toDataURL();
let size = img.getSize(); // {'width': 200, height: 150}
// Save to computer
let buffer = img.toPNG();
require('fs').writeFileSync('output_path/example.png', buffer);Properties
version
string property, get the current Eagle application version.
build
number property, get the current Eagle application Build Number.
locale
string property, get the current Eagle application interface language.
en- Englishzh_CN- Simplified Chinesezh_TW- Traditional Chineseja_JP- Japaneseko_KR- Koreanes_ES- Spanishde_DE- Germanru_RU- Russian
arch
string property, returns the CPU architecture of the operating system.
x64arm64x86
platform
string property, returns a string identifying the operating system platform.
darwin- macOS operating systemwin32- Windows operating system
env
Object property, returns an object of environment variables.
console.log(eagle.app.env);
{
APPDATA: "C:\\Users\\User\\AppData\\Roaming",
HOMEDRIVE: "C:",
HOMEPATH: "\\Users\\User",
LANG: "zh_TW.UTF-8",
TEMP: "C:\\Users\\User\\AppData\\Local\\Temp"
}console.log(eagle.app.env['TEMP']);
"C:\\Users\\User\\AppData\\Local\\Temp"execPath
string property, current application execution path.
console.log(eagle.app.execPath);
"C:\\Program Files\\Eagle\\Eagle.exe"pid
number property, current plugin process id.
isWindows
boolean property, is the current operating system Windows.
isMac
boolean property, is the current operating system Mac.
runningUnderARM64Translation
boolean property, when true it indicates that the current application is running in ARM64 runtime (e.g., macOS Rosetta Translator Environment or Windows WOW).
theme
string property, the current theme color name, such as LIGHT, LIGHTGRAY, GRAY, DARK, BLUE, PURPLE.
userDataPath
string property, the path to the current user data directory.
console.log(eagle.app.userDataPath);
"C:\\Users\\User\\AppData\\Roaming\\Eagle"Last updated