#read-write #encode #encoding

encode_rs_fs

Read and Write files with encoding_rs

3 releases

0.1.3 Feb 28, 2022
0.1.1 Feb 28, 2022
0.1.0 Feb 28, 2022

#167 in #encode

Download history 16/week @ 2024-02-25 1/week @ 2024-03-03 54/week @ 2024-03-31 1/week @ 2024-04-07

55 downloads per month

MIT license

4KB

encode_rs_fs

Read and Write files using encodings.

Documentation

Offical documentation can be found at https://docs.rs/encode_rs_fs

I think I would have preferred the library to be called encoding_rs_fs, but once I publishing to crate to crates.io it was to late, and, it can't be changed.

Usage

Add this to your Cargo.toml:

[dependencies]
encode_rs_fs = "0.1"

and this to your crate root:

extern crate encode_rs_fs;

For a full list of encodings that can be used refer to the documentions at Docs.rs.

Example

Use the functions to read and write entire files using a encoding.

extern crate encodingfs;

use::encode_rs_fs::{read, write};

fn main() {
    let test_file = "example.txt";
    let source = "ÁáAaBbCc";
    let codec = "latin1";

    write(test_file, source, codec).unwrap();
    let result = read(test_file, codec).unwrap();
    println!("Results {:?}", result);
}

Dependencies

~3MB
~117K SLoC