use crate::error::Error;
use std::path::Path;
#[doc(inline)]
pub use tokio::fs::*;
pub async fn read(path: impl AsRef<Path>) -> Result<Vec<u8>, Error> {
let path = path.as_ref().to_owned();
tokio::task::spawn_blocking(move || crate::fs::read(path)).await?
}
pub async fn read_to_string(path: impl AsRef<Path>) -> Result<String, Error> {
let path = path.as_ref().to_owned();
tokio::task::spawn_blocking(move || crate::fs::read_to_string(path)).await?
}
pub async fn write(path: impl AsRef<Path>, contents: impl AsRef<[u8]>) -> Result<(), Error> {
let path = path.as_ref().to_owned();
let contents = contents.as_ref().to_owned();
tokio::task::spawn_blocking(move || crate::fs::write(path, contents)).await?
}
pub async fn append(path: impl AsRef<Path>, contents: impl AsRef<[u8]>) -> Result<(), Error> {
let path = path.as_ref().to_owned();
let contents = contents.as_ref().to_owned();
tokio::task::spawn_blocking(move || crate::fs::append(path, contents)).await?
}