6 releases

0.1.5 Mar 2, 2023
0.1.4 Jul 4, 2022
0.1.3 May 9, 2022
0.1.2 Apr 25, 2022
0.1.1 Feb 27, 2022

#129 in #base64

29 downloads per month

MIT license

10KB
141 lines

base64-cli crates.io version crates.io downloads

A CLI tool for base64 which supports both native and WebAssembly

Note: This project is a fork of the original Rust implementation: rust-base64.

Installation

You can install this using the cargo install command:

$ cargo install base64-cli

WebAssembly

This application also provides a wasm package. You can install it using wapm by the following command:

$ wapm install ken-matsui/base64

Usage

$ base64-cli --help
base64-cli 0.1.0
A CLI tool for base64

USAGE:
    base64 <SUBCOMMAND>

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    decode    Decode base64 string to string
    encode    Encode string to base64 string
    help      Print this message or the help of the given subcommand(s)

WebAssembly

$ wapm run base64 --help
base64-cli 0.1.0
A CLI tool for base64

USAGE:
    base64 <SUBCOMMAND>

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    decode    Decode base64 string to string
    encode    Encode string to base64 string
    help      Print this message or the help of the given subcommand(s)

Examples

encode

$ base64-cli encode hello
aGVsbG8=

decode

$ base64-cli decode aGVsbG8=
hello

WebAssembly

encode

$ wapm run base64 encode hello
aGVsbG8=

decode

$ wapm run base64 decode aGVsbG8=
hello

Contribution

Build

$ cargo build

Or you can directly execute the binary:

$ cargo run

WebAssembly

$ rustup target add wasm32-wasi
$ cargo build --target wasm32-wasi
$ wasmer run target/wasm32-wasi/debug/base64-cli.wasm encode hello

Test

This command can also test C API.

$ cargo build
$ cargo test

Publish

GitHub Releases

$ git tag v0.1.0
$ git push origin v0.1.0

crates.io

$ cargo publish

wapm.io

$ cargo build --release --target wasm32-wasi
$ wapm publish

Dependencies

~1.4–3.5MB
~54K SLoC