fs-id

Crates.iofs-id
lib.rsfs-id
version0.2.0
sourcesrc
created_at2024-01-26 23:31:05.251023
updated_at2024-01-28 14:43:38.059204
descriptionUniquely identify files within the system
homepage
repositoryhttps://github.com/Maiori44/fs-id
max_upload_size
id1116083
size10,665
Felice D'Angelo (Maiori44)

documentation

README

fs-id

Little (mostly) cross-platform library to uniquely identify files (and other things).

For quick comparisons, compare_ids can be used:

use fs_id::compare_ids;

fn main() -> std::io::Result<()> {
	assert!(compare_ids("/some/file/path.txt", "/some/file/path.txt")?);
	Ok(())
}

For more advanced usage, FileID can be used:

use fs_id::FileID;

fn main() -> std::io::Result<()> {
	let file_id1 = FileID::new("/some/file/path.txt")?;
	let file_id2 = FileID::new("/some/file/path.txt")?;
	let file_id3 = FileID::new("/some/other/file.txt")?;
	assert_eq!(file_id1, file_id2);
	assert_ne!(file_id1, file_id3);
	println!("{} {}", file_id1.storage_id(), file_id1.internal_file_id());
	Ok(())
}
Commit count: 0

cargo fmt