df-rust
v0.0.3
Published
This project provides functionality similar to `df --output=fstype,source,size,used,avail,pcent,target -B1`, enabling cross-platform disk information retrieval implemented in Rust, and exported to JavaScript/TypeScript environments via NAPI.
Readme
df-rust
This project provides functionality similar to df --output=fstype,source,size,used,avail,pcent,target -B1, enabling cross-platform disk information retrieval implemented in Rust, and exported to JavaScript/TypeScript environments via NAPI.
Features
- Retrieve all disk information: including filesystem type, mount point, total space, used space, available space, and usage percentage
- Cross-platform support
- Uses the sysinfo library for reliable and efficient disk information retrieval
Installation
Note: Before installing this package, please ensure that Rust is installed on your system. Rust is a required dependency for building this project.
Build and install from the project root directory:
npm install
npm run rebuildUsage Example
import df from "df-rust";
const disks = df();
console.log(disks);Example return value (partial fields shown):
[
{
fstype: "NTFS",
source: "System",
size: 536871956480n,
used: 130712150016n,
avail: 406159806464n,
pcent: 24.347,
target: "C:\\",
},
];Development/Build
npm install
npm run rebuildLicense
Licensed under the MIT License.
