mirror of
https://github.com/sxyazi/yazi.git
synced 2026-05-13 08:16:40 +00:00
feat: virtual file system (#3034)
This commit is contained in:
parent
da97e5a8b4
commit
d5f225bc4a
74 changed files with 908 additions and 447 deletions
|
|
@ -1,10 +1,8 @@
|
|||
use std::io::BufReader;
|
||||
|
||||
use anyhow::Result;
|
||||
use image::{DynamicImage, ExtendedColorType, ImageDecoder, ImageEncoder, ImageError, ImageFormat, ImageReader, ImageResult, Limits, codecs::{jpeg::JpegEncoder, png::PngEncoder}, imageops::FilterType, metadata::Orientation};
|
||||
use ratatui::layout::Rect;
|
||||
use yazi_config::YAZI;
|
||||
use yazi_fs::services;
|
||||
use yazi_fs::provider;
|
||||
use yazi_shared::url::Url;
|
||||
|
||||
use crate::Dimension;
|
||||
|
|
@ -40,7 +38,7 @@ impl Image {
|
|||
})
|
||||
.await??;
|
||||
|
||||
Ok(services::write(cache, buf).await?)
|
||||
Ok(provider::write(cache, buf).await?)
|
||||
}
|
||||
|
||||
pub(super) async fn downscale(url: &Url, rect: Rect) -> Result<DynamicImage> {
|
||||
|
|
@ -110,7 +108,7 @@ impl Image {
|
|||
limits.max_image_height = Some(YAZI.tasks.image_bound[1] as u32);
|
||||
}
|
||||
|
||||
let mut reader = ImageReader::new(BufReader::new(services::open(&url).await?.into_std().await));
|
||||
let mut reader = ImageReader::new(provider::open(&url).await?.reader_sync().await);
|
||||
if let Ok(format) = ImageFormat::from_path(url) {
|
||||
reader.set_format(format);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue