futures-fs icon indicating copy to clipboard operation
futures-fs copied to clipboard

Support for accessing metadata?

Open shepmaster opened this issue 7 years ago • 1 comments

For purposes of HTTP caching, it would be good to have access to the metadata of the file, specifically to get the modification time. I was thinking a structure mimicking Hyper would be reasonable:

struct AsyncFileRequest(/* ... */);

impl Future for AsyncFileRequest {
    type Item = Something;
    type Err = std::io::Err;
}

struct Something {
    metadata: std::fs::Metadata,
    body: AsyncFileBodyRequest,
}

impl Stream for AsyncFileBodyRequest {
    type Item = Bytes;
    type Err = std::io::Err;
}

Does something along these lines seem reasonable?

shepmaster avatar Mar 05 '18 22:03 shepmaster

I think adding fs.metadata(path) -> MetadataFuture makes a lot of sense!

seanmonstar avatar Mar 06 '18 00:03 seanmonstar