diff --git a/src/http_assets.rs b/src/http_assets.rs index cc6c4cf..1feb6c7 100644 --- a/src/http_assets.rs +++ b/src/http_assets.rs @@ -76,7 +76,9 @@ impl AssetReader for HttpAssetReader { // Write asset to cache, but ensure only one HttpAssetReader writes at any given point in time if self.sync.write().unwrap().insert(cache_path.clone()) { async_fs::create_dir_all(cache_path.parent().unwrap()).await?; - File::create(&cache_path).await?.write_all(&bytes).await?; + let mut file = File::create(&cache_path).await?; + file.write_all(&bytes).await?; + file.flush().await?; } } Ok(Box::new(VecReader::new(bytes)) as Box>)