I am referring to the type
Bytes from the crate
My first idea was to read the file using
tokio-fs (the docs should say something about requiring an
Arc<Path> as input for the
read function…) and then put it into a cache for future requests, but you can’t get a weak pointer to
Bytes, so that won’t work.
I am also planing to break large files into chucks and only store a certain amount of them to avoid OOM.
I am currently streaming chunks to hyper with
Body::channel() from that crate.
Basically the idea of the weak pointer to the bytes (of the chunks I guess) was that during multiple downloads of the file memory would be used optimally, but I now know you can’t do that.
Also you could implement HTTP range support quite well(i.e not using too much ram) with that approach.