add url{e,d}

This commit is contained in:
Rasmus Moorats 2024-08-29 17:25:00 +03:00
parent 1a9404b0c8
commit d7969dc4b7
Signed by: xx
GPG key ID: FE14255A6AE7241C
4 changed files with 40 additions and 0 deletions

7
Cargo.lock generated
View file

@ -155,6 +155,7 @@ dependencies = [
"base64",
"dirs",
"rand",
"urlencoding",
"walkdir",
]
@ -204,6 +205,12 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "urlencoding"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
[[package]]
name = "walkdir"
version = "2.5.0"

View file

@ -12,3 +12,4 @@ base64 = "0.22.1"
walkdir = "2.5.0"
rand = "0.8.5"
dirs = "5.0.1"
urlencoding = "2.1.3"

16
src/bin/urld.rs Normal file
View file

@ -0,0 +1,16 @@
use std::error;
use rutils::*;
use urlencoding::decode_binary;
fn main() -> Result<(), Box<dyn error::Error>> {
let inputs = get_input()?;
let mut first = true;
for input in inputs {
let out = decode_binary(input.as_slice());
print(out.into_owned().as_slice(), first)?;
first = false;
}
Ok(())
}

16
src/bin/urle.rs Normal file
View file

@ -0,0 +1,16 @@
use std::error;
use rutils::*;
use urlencoding::encode_binary;
fn main() -> Result<(), Box<dyn error::Error>> {
let inputs = get_input()?;
let mut first = true;
for input in inputs {
let out = encode_binary(input.as_slice());
print(out.as_bytes(), first)?;
first = false;
}
Ok(())
}