{"id":13800828,"url":"https://github.com/HuakunShen/tauri-plugin-system-info","last_synced_at":"2025-05-13T09:31:57.082Z","repository":{"id":188791868,"uuid":"679174296","full_name":"HuakunShen/tauri-plugin-system-info","owner":"HuakunShen","description":"Tauri plugin for obtaining system info (network, memory, cpu, process)","archived":false,"fork":false,"pushed_at":"2025-04-03T14:26:28.000Z","size":838,"stargazers_count":43,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"v2","last_synced_at":"2025-05-11T11:39:15.262Z","etag":null,"topics":["rust","tauri","typescript"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HuakunShen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["HuakunShen"],"buy_me_a_coffee":"huakun"}},"created_at":"2023-08-16T09:00:28.000Z","updated_at":"2025-04-20T22:14:45.000Z","dependencies_parsed_at":"2024-12-25T22:07:19.593Z","dependency_job_id":"fe938fa5-868b-4d0b-a0df-9126dd63f895","html_url":"https://github.com/HuakunShen/tauri-plugin-system-info","commit_stats":{"total_commits":52,"total_committers":1,"mean_commits":52.0,"dds":0.0,"last_synced_commit":"990320d9068b832c6291bccb1e252cf7175bd4a6"},"previous_names":["huakunshen/tauri-plugin-system-info"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuakunShen%2Ftauri-plugin-system-info","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuakunShen%2Ftauri-plugin-system-info/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuakunShen%2Ftauri-plugin-system-info/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuakunShen%2Ftauri-plugin-system-info/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HuakunShen","download_url":"https://codeload.github.com/HuakunShen/tauri-plugin-system-info/tar.gz/refs/heads/v2","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253913245,"owners_count":21983284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","tauri","typescript"],"created_at":"2024-08-04T00:01:16.700Z","updated_at":"2025-05-13T09:31:57.069Z","avatar_url":"https://github.com/HuakunShen.png","language":"Rust","funding_links":["https://github.com/sponsors/HuakunShen","https://buymeacoffee.com/huakun"],"categories":["Development"],"sub_categories":["Plugins"],"readme":"# Tauri Plugin system-info\n\nTypeScript Documentation: https://huakunshen.github.io/tauri-plugin-system-info\nRust Documentation: https://docs.rs/crate/tauri-plugin-system-info\n\n\u003e This is a Tauri plugin for reading system information.\n\n- Rust Crate: https://crates.io/crates/tauri-plugin-system-info\n- TypeScript API: https://www.npmjs.com/package/tauri-plugin-system-info-api\n\n## Demo App\n\n![](https://i.imgur.com/tcuNU4K.png)\n\n## Installation\n\n\u003e If you are installing from npm and crates.io package registry, make sure the versions for both packages are the same, otherwise, the API may not match.\n\n\u003e For Tauri v1 app, use version 1.x, for Tauri v2 app, use version 2.x. (this applies to both npm and crates.io packages)\n\n### Rust Install\n\n`cargo add tauri-plugin-system-info` within `src-tauri` to add the package.\n\nOr add the following to your `Cargo.toml` for the latest unpublished version (not recommanded).\n\n```toml\ntauri-plugin-system-info = { git = \"https://github.com/HuakunShen/tauri-plugin-system-info\", branch = \"v1\" } # use v2 branch for Tauri v2 plugin\n```\n\n### NPM Install\n\nRun the following to install JavaScript/TypeScript API package.\n\n```bash\nnpm i tauri-plugin-system-info-api\n# npm add https://github.com/HuakunShen/tauri-plugin-system-info # or this for latest unpublished version (not recommended)\n```\n\nIn `main.rs`, add the following to your `tauri::Builder`:\n\n```rust\nfn main() {\n    tauri::Builder::default()\n        .plugin(tauri_plugin_system_info::init())\n        .run(tauri::generate_context!())\n        .expect(\"error while running tauri application\");\n}\n```\n\n## Info Supported\n\n- [x] CPU\n- [x] Network\n- [x] Process\n- [x] Memory\n- [x] Hostname\n- [x] Kernel Version\n- [x] OS Version\n- [x] Battery\n\n## Third Party Libraries Used\n\n- [`sysinfo`](https://crates.io/crates/sysinfo)\n\n## API\n\n### TypeScript\n\nAll TypeScript APIs can be found in [api.ts](./webview-src/api.ts).\n\nReturn type of each API is added. The object structures can be found in [type.ts](./webview-src/type.ts).\n\nValibot was used to define type schema and infer TypeScript types. You can import the types exported from the npm package.\n\nThe exported Valibot schemas can be used to parse data and make sure the data returned from rust APIs match the desired structure defined in schema.\n\n```typescript\nimport {\n  allSysInfo,\n  memoryInfo,\n  staticInfo,\n  cpuInfo,\n  AllSystemInfo,\n  StaticInfo,\n  MemoryInfo,\n  CpuInfo,\n  batteries,\n  Batteries,\n} from \"tauri-plugin-system-info-api\";\n\nconsole.log(AllSystemInfo.parse(await allSysInfo()));\nconsole.log(MemoryInfo.parse(await memoryInfo()));\nconsole.log(StaticInfo.parse(await staticInfo()));\nconsole.log(CpuInfo.parse(await cpuInfo()));\nconsole.log(Batteries.parse(await batteries()));\n```\n\n### Rust\n\nThe API functions in Rust are all exported, so that you can also build your own commands.\n\nHere is a simple example:\n\n```rust\nuse tauri_plugin_system_info::utils::{SysInfo, SysInfoState};\nuse tauri_plugin_system_info::commands;\nuse tauri_plugin_system_info::model::Cpu;\n\n#[tauri::command]\nfn cpu_count() -\u003e Result\u003cusize, String\u003e {\n    let state = SysInfoState::default();\n    let sysinfo = state.sysinfo.lock().unwrap();\n    let cpu_count = sysinfo.cpu_count();\n    Ok(cpu_count)\n}\n```\n\nSee https://docs.rs/crate/tauri-plugin-system-info/ for full rust documentation.\n\n`SysInfo` is the API struct that can be used to access all information. It's like a wrapper for `sysinfo` APIs and other crates. The reason for doing this is, some structs in third party libraries cannot be cloned or serialized, and thus cannot be sent to the frontend.\n\nI aggregate all the APIs, do structure conversion and serilization with custom code.\n\n## Usage\n\nSee [SvelteKit Example](./examples/sveltekit/README.md) for an example written with SvelteKit.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHuakunShen%2Ftauri-plugin-system-info","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHuakunShen%2Ftauri-plugin-system-info","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHuakunShen%2Ftauri-plugin-system-info/lists"}