Skip to content

Commit

Permalink
⬆️ Update base64, opener requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
davidB committed Jan 7, 2025
1 parent a80751a commit e1fd7ef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ readme = "README.md"
keywords = ["evcxr", "jupyter", "visualization", "plot", "vega"]

[dependencies]
base64 = "^0.13"
opener = "^0.4"
base64 = "^0.22"
opener = "^0.7"
anyhow = "^1.0"

#arrow = {version = "0.13.0", optional = true} # nightly
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mod show_ndarray;
mod show_image;

use anyhow::Error;
use base64::prelude::*;
use std::path::Path;
use std::path::PathBuf;
use std::time::SystemTime;
Expand Down Expand Up @@ -147,7 +148,7 @@ pub fn show_text_in_jupyter<M: AsRef<str>, S: AsRef<str>>(mime_type: M, text: S)
/// ```
// TODO replace by evcxr_runtime ?
pub fn show_bytes_in_jupyter<S: AsRef<str>>(mime_type: S, buffer: &[u8]) {
show_text_in_jupyter(mime_type, base64::encode(buffer))
show_text_in_jupyter(mime_type, BASE64_STANDARD.encode(buffer))
}

/// Display the content of a local file.
Expand Down
4 changes: 2 additions & 2 deletions src/show_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use crate::ContentInfo;
use crate::Showable;
use anyhow::{anyhow, Error};
use base64;
use base64::prelude::*;
use image;
use std::ops::Deref;

Expand Down Expand Up @@ -46,7 +46,7 @@ where
<P as image::Pixel>::COLOR_TYPE,
)?;
Ok(ContentInfo {
content: base64::encode(&buffer),
content: BASE64_STANDARD.encode(&buffer),
mime_type: "image/png;base64".into(),
})
}
Expand Down

0 comments on commit e1fd7ef

Please sign in to comment.