pre-allocate some amount of media read buffer

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2025-01-18 09:47:17 +00:00
parent afdf5a07b5
commit c6ae6adc80

View file

@ -157,7 +157,7 @@ impl Service {
if let Ok(Metadata { content_disposition, content_type, key }) =
self.db.search_file_metadata(mxc, &Dim::default()).await
{
let mut content = Vec::new();
let mut content = Vec::with_capacity(8192);
let path = self.get_media_file(&key);
BufReader::new(fs::File::open(path).await?)
.read_to_end(&mut content)