Skip to content

xlch88/df-rust

Repository files navigation

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 rebuild

Usage 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 rebuild

License

Licensed under the MIT License.

About

Cross-platform disk info utility in Rust, exported to JS/TS via NAPI, replicating df --output=fstype,source,size,used,avail,pcent,target -B1.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors