pub fn head_to_string_with_message(
path: impl AsRef<Path>,
limit: usize,
truncation_message: &str,
) -> Result<String>
Expand description
Reads the first N
bytes from a file and return them as a string. If the file size is greater
than N
bytes, the truncation message will be put at the end of the String.
It assumes that the file is encoded with UTF-8, so any invalid UTF-8 sequences will be
replaced with U+FFFD REPLACEMENT CHARACTER
, which looks like this: �, learn more
here).