Crate async_fs

source ·
Expand description

Async filesystem primitives.

This crate is an async version of std::fs.


This crate uses blocking to offload blocking I/O onto a thread pool.


Create a new file and write some bytes to it:

use async_fs::File;
use futures_lite::io::AsyncWriteExt;

let mut file = File::create("a.txt").await?;
file.write_all(b"Hello, world!").await?;


pub use std::fs::FileType;
pub use std::fs::Metadata;
pub use std::fs::Permissions;


Unix-specific extensions.


A builder for creating directories with configurable options.
An entry in a directory.
An open file on the filesystem.
A builder for opening files with configurable options.
A stream of entries in a directory.


Returns the canonical form of a path.
Copies a file to a new location.
Creates a directory.
Creates a directory and its parent directories if they are missing.
Creates a hard link on the filesystem.
Reads metadata for a path.
Reads the entire contents of a file as raw bytes.
Returns a stream of entries in a directory.
Reads a symbolic link and returns the path it points to.
Reads the entire contents of a file as a string.
Removes an empty directory.
Removes a directory and all of its contents.
Removes a file.
Renames a file or directory to a new location.
Changes the permissions of a file or directory.
Reads metadata for a path without following symbolic links.
Writes a slice of bytes as the new contents of a file.