Expand description
Contains various std::fs wrapper functions that also contain the target path in their errors.
Re-exportsยง
use crate::errors::FsPathError;๐use flate2::Compression;๐use flate2::read::GzDecoder;๐use flate2::write::GzEncoder;๐use serde::Serialize;๐use serde::Serialize;๐use serde::de::DeserializeOwned;๐use std::fs;๐use std::fs::File;๐use std::io::BufReader;๐use std::io::BufWriter;๐use std::io::Read;๐use std::io::Seek;๐use std::io::SeekFrom;๐use std::io::Write;๐use std::path::Component;๐use std::path::Path;๐use std::path::PathBuf;๐use std::os::unix::fs::OpenOptionsExt;๐Unix use std::os::unix::fs::PermissionsExt;๐Unix
Functionsยง
- canonicalize_
path - Canonicalize a path, returning an error if the path does not exist.
- copy
- Wrapper for
std::fs::copy - create_
dir - Wrapper for
std::fs::create_dir - create_
dir_ all - Wrapper for
std::fs::create_dir_all - create_
file - Wrapper for
File::create. - files_
with_ ext - Returns an iterator over all files with the given extension under the
rootdir. - json_
files - Returns an iterator over all JSON files under the
rootdir. - locked_
read - Reads the entire contents of a locked shared file into a bytes vector.
- locked_
read_ to_ string - Reads the entire contents of a locked shared file into a string.
- locked_
write - Writes all content in an exclusive locked file.
- locked_
write_ line - Writes a line in an exclusive locked file.
- locked_
write_ ๐line_ windows - normalize_
path - Normalize a path, removing things like
.and... - open
- Wrapper for
std::fs::File::open - read
- Wrapper for
std::fs::read. - read_
inner ๐ - read_
json_ file - Reads the JSON file and deserialize it into the provided type.
- read_
json_ gzip_ file - Reads and decodes the json gzip file, then deserialize it into the provided type.
- read_
link - Wrapper for
std::fs::read_link. - read_
to_ string - Wrapper for
std::fs::read_to_string. - remove_
dir - Wrapper for
std::fs::remove_dir - remove_
dir_ all - Wrapper for
std::fs::remove_dir_all - remove_
file - Wrapper for
std::fs::remove_file. - write
- Wrapper for
std::fs::write - write_
json_ file - Writes the object as a JSON object.
- write_
json_ gzip_ file - Writes the object as a gzip compressed file.
- write_
pretty_ ๐json - write_
pretty_ json_ file - Writes the object as a pretty JSON object.
- write_
sensitive_ json_ file - Writes an object as pretty JSON with owner-only permissions on Unix.