AnBowell / s3-filesystem

An async Rust crate to treat S3 files as if they were local
3 stars 0 forks source link

Absolute filepath #8

Open IndigoCurnick opened 10 months ago

IndigoCurnick commented 10 months ago

The current entry.path is the relative path to the file from the local duplicate of the S3 bucket.

It would be nice to have a entry.absolute_path, which gives the location of the file on the harddrive

let bucket = "some-bucket".to_string();
let open_options = OpenOptions::new(bucket, None)
    .await
    .mount_path("data/")
    .force_download(false);
let data = open_options.walkdir("some-folder").await.unwrap();

for entry in data {
    entry.path; // /some-folder/some-file
    entry.absolute_path; // /home/path-to-bucket/some-bucket/some-folder/some-file
}
AnBowell commented 9 months ago

I've been thinking about this and I think I probably won't implement it, at least for now. At the time of using walkdir, the files won't be on the local system necessarily so this will have to be an optional path dependent on their existence.