pub async fn write<C: AsRef<[u8]> + Unpin>(
path: impl AsRef<Path>,
contents: C,
) -> Result<()>
Available on crate feature
fs
only.Expand description
Creates a future that will open a file for writing and write the entire
contents of contents
to it.
This is the async equivalent of std::fs::write
.
ยงExamples
use tokio::fs;
fs::write("foo.txt", b"Hello world!").await?;