npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tauri-plugin-device-info-api

v1.0.1

Published

A Tauri plugin to access device information.

Readme

Tauri Plugin device-info

npm version npm downloads Crates.io Crates.io Downloads GitHub stars GitHub forks License CI

A comprehensive Tauri plugin to access device information including Battery, Network, Storage, Display, and System Details.


📖 Read the Documentation

📸 Preview

Platform Support

| Platform | Support | | -------- | ------- | | Windows | ✅ | | macOS | ✅ | | Linux | ✅ | | iOS | ✅ | | Android | ✅ |

Installation

Using Tauri CLI (Recommended)

npm run tauri add device-info
# or
yarn tauri add device-info

Manual Installation

Cargo.toml: Crates.io

[dependencies]
tauri-plugin-device-info = "1.0"  # Check crates.io for latest version
# or from git
tauri-plugin-device-info = { git = "https://github.com/edisdev/tauri-plugin-device-info" }

package.json: npm version

{
  "dependencies": {
    "tauri-plugin-device-info-api": "^1.0.0"
  }
}

Setup

Register the plugin in your Tauri app:

src-tauri/src/lib.rs:

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_device_info::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Usage

import {
  getDeviceInfo,
  getBatteryInfo,
  getNetworkInfo,
  getStorageInfo,
  getDisplayInfo,
} from "tauri-plugin-device-info-api";

// Get device information
const device = await getDeviceInfo();
console.log(device);

Response:

{
  "uuid": "550e8400-e29b-41d4-a716-446655440000",
  "manufacturer": "Apple Inc.",
  "model": "MacBookPro16,1",
  "serial": "C02XG2JHJG5H",
  "android_id": null,
  "device_name": "John's MacBook Pro"
}
// Get battery status
const battery = await getBatteryInfo();
console.log(battery);

Response:

{
  "level": 85,
  "isCharging": true,
  "health": "Good"
}
// Get network information
const network = await getNetworkInfo();
console.log(network);

Response:

{
  "ipAddress": "192.168.x.x",
  "networkType": "wifi",
  "macAddress": "a1:b2:c3:d4:e5:f6"
}
// Get storage information
const storage = await getStorageInfo();
console.log(storage);

Response:

{
  "totalSpace": 500107862016,
  "freeSpace": 125026965504,
  "storageType": "SSD"
}
// Get display information
const display = await getDisplayInfo();
console.log(display);

Response:

{
  "width": 2560,
  "height": 1600,
  "scaleFactor": 2.0,
  "refreshRate": 120
}

API Reference

getDeviceInfo()

Returns device identification and hardware information.

| Field | Type | Description | | -------------- | --------- | -------------------------------------------- | | uuid | string? | Unique device identifier | | manufacturer | string? | Device manufacturer (e.g., "Apple Inc.") | | model | string? | Device model (e.g., "MacBookPro16,1") | | serial | string? | Serial number (restricted on some platforms) | | android_id | string? | Android-specific ID (Android only) | | device_name | string? | User-assigned device name |

getBatteryInfo()

Returns battery status and health information.

| Field | Type | Description | | ------------ | ---------- | ------------------------------ | | level | number? | Battery percentage (0-100) | | isCharging | boolean? | Whether the device is charging | | health | string? | Battery health status |

getNetworkInfo()

Returns network connection details.

| Field | Type | Description | | ------------- | --------- | ---------------------------------------------------------- | | ipAddress | string? | Local IP address | | networkType | string? | Connection type: "wifi", "cellular", "ethernet", "unknown" | | macAddress | string? | MAC address (unavailable on iOS/Android due to privacy) |

getStorageInfo()

Returns storage capacity information.

| Field | Type | Description | | ------------- | --------- | -------------------------------------- | | totalSpace | number? | Total storage in bytes | | freeSpace | number? | Available storage in bytes | | storageType | string? | Storage type: "SSD", "HDD", "internal" |

getDisplayInfo()

Returns display/screen information.

| Field | Type | Description | | ------------- | --------- | ------------------------------------------- | | width | number? | Screen width in pixels | | height | number? | Screen height in pixels | | scaleFactor | number? | Display scale factor (e.g., 2.0 for Retina) | | refreshRate | number? | Screen refresh rate in Hz |

TypeScript Types

All types are exported and can be imported:

import type {
  DeviceInfoResponse,
  BatteryInfo,
  NetworkInfo,
  StorageInfo,
  DisplayInfo,
} from "tauri-plugin-device-info-api";

Permissions

Add the required permissions in your capabilities configuration.

src-tauri/capabilities/default.json:

{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "description": "Capability for the main window",
  "windows": ["main"],
  "permissions": ["core:default", "device-info:default"]
}

Available Permissions

| Permission | Description | | ------------------------------------ | --------------------------------- | | device-info:default | Enables all device-info commands | | device-info:allow-get-device-info | Allows getting device information | | device-info:allow-get-battery-info | Allows getting battery status | | device-info:allow-get-network-info | Allows getting network details | | device-info:allow-get-storage-info | Allows getting storage info | | device-info:allow-get-display-info | Allows getting display info |

Individual Permissions Example

If you want to grant only specific permissions:

{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "description": "Capability for the main window",
  "windows": ["main"],
  "permissions": [
    "core:default",
    "device-info:allow-get-battery-info",
    "device-info:allow-get-network-info"
  ]
}

Platform-Specific Notes

iOS

  • MAC address is not available due to Apple's privacy restrictions (returns "unavailable")
  • Serial number uses a persistent Keychain-stored UUID

Android

  • MAC address is restricted on Android 6.0+ (returns "restricted")
  • Requires no special permissions for basic device info

macOS

  • Uses native CoreGraphics API for accurate refresh rate detection
  • Full access to all device information

Windows

  • Uses WMI (Windows Management Instrumentation) for device info
  • Full access to all device information

Linux

  • Display refresh rate requires X11 (xrandr)
  • Device info read from /sys/class/dmi/id/

License

MIT