Skip to content

API Reference

This plugin provides 5 main functions to access device information.

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

Quick Reference

typescript
import { 
  getDeviceInfo,    // → DeviceInfoResponse
  getBatteryInfo,   // → BatteryInfo
  getNetworkInfo,   // → NetworkInfo
  getStorageInfo,   // → StorageInfo
  getDisplayInfo    // → DisplayInfo
} from 'tauri-plugin-device-info-api';

Type Exports

All response types are exported for TypeScript users:

typescript
import type { 
  DeviceInfoResponse, 
  BatteryInfo, 
  NetworkInfo, 
  StorageInfo, 
  DisplayInfo 
} 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.