easy_base64

Crates.ioeasy_base64
lib.rseasy_base64
version0.1.7
sourcesrc
created_at2023-05-22 07:28:08.804864
updated_at2023-05-30 07:51:38.646785
descriptionThe package provides the base64 encode/decode functions.
homepagehttps://github.com/zaqxsw-dev/easy_base64
repositoryhttps://github.com/zaqxsw-dev/easy_base64
max_upload_size
id870416
size11,338
Bogdan Lipovtsev (zaqxsw-dev)

documentation

https://docs.rs/easy_base64/0.1.0/easy_base64/

README

Contributors Forks Stargazers Issues MIT License LinkedIn


easy_base64

Simple, small and fast, dependency free base64 encoder/decoder.
Explore the docs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact

About The Project

I have created a library for people who simply need to encode and decode data to and from Base64 with a straightforward API. The purpose of this library is to reduce the time between when a person discovers the library and when they start using it. Additionally, the aim is to avoid burdening the project with extra dependencies and increasing compilation time.

(back to top)

Getting Started

Just add new dependencie in your Cargo.toml file.

  • Cargo.toml
    [dependencies]
    easy_base64 = "0.1"
    

Usage

use easy_base64::{decode, encode};

fn main() {
    let decoded_b64 = decode(b"U3U=");
    println!("Decoded: {}", String::from_utf8(decoded_b64).unwrap());

    let encoded_b64 = encode(b"Su");
    println!("Encoded: {}", encoded_b64);

    // if you have String
    let decoded_b64 = decode(String::from("U3U=").as_bytes());
    println!("Decoded: {}", String::from_utf8(decoded_b64).unwrap());

    let encoded_b64 = encode(String::from("Su").as_bytes());
    println!("Encoded: {}", encoded_b64);
}

Why encode return a String, but decode return a bytes?

Because base64 encoded the result always contains valid printable string symbols. But if was encoded binary data, then decode result not will be valid string.

For more examples, please refer to the Documentation

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Bogdan Lipovtsev - megafreelancer2012@gmail.com

Project Link: https://github.com/zaqxsw-dev/easy_base64

(back to top)

Commit count: 20

cargo fmt