http-server-rs 0.0.21

Simple, zero-configuration command-line static HTTP server.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#![allow(unused)]

use base64::prelude::*;

pub fn encode<S: AsRef<str>>(input: S) -> String {
  BASE64_STANDARD.encode(input.as_ref().as_bytes())
}

pub fn decode_bytes<S: AsRef<str>>(input: S) -> anyhow::Result<Vec<u8>> {
  Ok(BASE64_STANDARD.decode(input.as_ref().as_bytes())?)
}

pub fn decode_string<S: AsRef<str>>(input: S) -> anyhow::Result<String> {
  Ok(String::from_utf8(decode_bytes(input)?)?)
}