cacache-rs
cacache-rs copied to clipboard
feature request: tokio::io::AsyncSeek support for Reader
Use case: I have zip files being added to a cacache instance, and zip is a non-streamable format - the index of a zip is at the end, so it is somewhat inefficient to read everything, then scan the index, then reopen and re-read to extract the actual content (using async_zip)
sure, this sounds good.
Ideally, we'll also have the async-std version of this done at the same time, though.
What do you think the API would look like @zkat ? The Reader in cacache also performs integrity checks, if we could seek in the file this becomes much harder.
yeah I have no idea how that would work tbh
I think you could read through to do the verification, then let the caller use seek to read the bits they need; the main point is to not have to buffer the entire file in RAM or make a temp copy of it, when using a non-streamable layer on top
Yeah. And we can have the unchecked and checked versions, in case you don't want to read the whole thing because, e.g. the file is enormous.
Ok.
I'll take a PR for this if anyone's interested, but it would need to be implemented for tokio, async-std, and sync. I don't want feature drift between the backends.