pub fn head_to_string(path: impl AsRef<Path>, limit: usize) -> Result<String>
Expand description
Reads the first N
bytes from a file and return them as a 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).
It is equivalent to head -c limit
*nix utility.