I have an array of u8
in Rust. How would I go about converting these to a String
representing them as base64?
What you're looking for is the base64
crate, particularly its encode()
function. Usage is pretty straightforward:
extern crate base64;
fn main() {
let data: Vec<u8> = vec![1,2,3,4,5];
println!("{}", base64::encode(&data))
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With