3 releases

new 0.1.2 Dec 28, 2024
0.1.1 Dec 28, 2024
0.1.0 Dec 27, 2024

#599 in Filesystem

Download history 296/week @ 2024-12-25

296 downloads per month
Used in notify-win-debouncer-full

MIT/Apache

10KB
108 lines

Win File Id

» Docs

A utility to read file IDs.

Modern file systems assign a unique ID to each file. On Windows it is called file index. Together with the device id, a file can be identified uniquely on a device at a given time.

Keep in mind though, that IDs may be re-used at some point.

Example

let file_id = win_file_id::get_file_id(path).unwrap();

println!("{file_id:?}");

Features

  • serde for serde support, off by default

lib.rs:

Utility for reading file ids (Windows) that uniquely identify a file on a single computer.

Modern file systems assign a unique ID to each file. On Windows it is called a file id or file index. Together with the device id (Linux, macOS) or the volume serial number (Windows), a file or directory can be uniquely identified on a single computer at a given time.

Keep in mind though, that IDs may be re-used at some point.

Example

let file = tempfile::NamedTempFile::new().unwrap();

let file_id = win_file_id::get_file_id(file.path()).unwrap();
println!("{file_id:?}");

Example (Windows Only)

let file = tempfile::NamedTempFile::new().unwrap();

let file_id = win_file_id::get_low_res_file_id(file.path()).unwrap();
println!("{file_id:?}");

let file_id = win_file_id::get_high_res_file_id(file.path()).unwrap();
println!("{file_id:?}");

Dependencies

~9–17MB
~216K SLoC