fsextra

Note: this library has not been externally tested for security and usage is at your own risk.

Build Status

fsextra is a collection of extensions to simplify working with Unix-based filesystems. This library will also support cryptographic operations on files and directories by enabling the crypto feature (> v0.2.0).

Installation

Install default features by updating your Cargo.toml file to include fsextra = "*".

```toml

your Cargo.toml

[package] name = "your-package" version = "0.1.0" edition = "2018"

See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies] fsextra = "*"

optionally enable crypto feature

fsextra = { version = "*", features = ["crypto"] } ```

Known Limitations

Dependencies

Compatibility

This library supports Unix-based operating systems and is not tested for other operating systems at this time (v0.3.0). Since v0.3.0, any OS-specific functionality is hidden behind cfg attributes. Since v0.3.0-alpha.1, updates are tested against Unix (linux) and Windows operating systems.

Basic Usage

For complete examples, please see our [Documentation].

```rust use fsextra::extensions::{MetadataExtended, FileExtended}; use fsextra::crypto::digest::{Digest, DigestAlgorithm}; use std::fs::File; use std::io::{Write, Result};

fn main() -> Result<()> { let file = File::open("path/to/executable")?; let metadata = file.metadata()?;

if !metadata.is_executable() {
    let digest = file.digest(DigestAlgorithm::Sha2);
    assert_eq!(hex::encode(digest), "7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9");
}

Ok(())

} ```

Testing

Cross targets:

This library can be tested using Cargo (as usual) with cargo test. It's recommended to test with and without --all-features. When local testing, it's recommended to use [Cross] to achieve testing for the targets listed above.

To use [Cross] to test: cross test --target {target} --all-features.

Learn More