temi 0.1.2

Command-line, lightweight TUI client for Lemmy
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Library utilities.

use crate::Result;

/// Convenience function for writing bytes to a file.
///
/// Mostly helpful for debugging API endpoint responses.
pub fn write_to_file(file_name: &str, bytes: &[u8]) -> Result<()> {
    use std::io::Write;

    let mut file = std::fs::File::create(file_name)?;
    file.write_all(bytes)?;

    Ok(())
}