Skip to content

API Reference ​

This plugin provides 5 getters to read device information, a reactive watch API to subscribe to changes, and adaptive signals that turn readings into decisions.

Functions Overview ​

FunctionDescription
getDeviceInfo()Device identification and hardware info
getBatteryInfo()Battery status and health
getNetworkInfo()Network connection details
getStorageInfo()Storage capacity information
getDisplayInfo()Display properties and capabilities
watch*()Subscribe to changes for any of the above kinds
getPowerProfile()full / balanced / saver from battery, power saving and thermal state
getDeviceTier()low / mid / high hardware capability class

Quick Reference ​

typescript
import { 
  getDeviceInfo,    // → DeviceInfoResponse
  getBatteryInfo,   // → BatteryInfo
  getNetworkInfo,   // → NetworkInfo
  getStorageInfo,   // → StorageInfo
  getDisplayInfo,   // → DisplayInfo
  getPowerProfile,  // → PowerProfile
  getDeviceTier,    // → DeviceTier

  // Reactive watch API → Promise<UnwatchFn>
  watchDevice,
  watchBattery,
  watchNetwork,
  watchStorage,
  watchDisplay,
  watchPowerProfile
} from 'tauri-plugin-device-info-api';

Type Exports ​

All response types are exported for TypeScript users:

typescript
import type { 
  DeviceInfoResponse, 
  BatteryInfo, 
  NetworkInfo, 
  StorageInfo, 
  DisplayInfo,
  PowerProfile,
  DeviceTier,
  WatchOptions,
  UnwatchFn
} from 'tauri-plugin-device-info-api';

Naming Convention ​

The JavaScript API uses camelCase for all property names:

Rust (internal)JavaScript
is_chargingisCharging
ip_addressipAddress
mac_addressmacAddress
total_spacetotalSpace
free_spacefreeSpace
storage_typestorageType
scale_factorscaleFactor
refresh_raterefreshRate

Released under the MIT License.