Crate smol::fs

source ·
Expand description

Async filesystem primitives.

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

§Implementation

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

§Examples

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?;
file.flush().await?;

Modules§

  • Unix-specific extensions.

Structs§

  • A builder for creating directories with configurable options.
  • An entry in a directory.
  • An open file on the filesystem.
  • A structure representing a type of file with accessors for each file type. It is returned by Metadata::file_type method.
  • Metadata information about a file.
  • A builder for opening files with configurable options.
  • Representation of the various permissions on a file.
  • A stream of entries in a directory.

Functions§

  • Returns the canonical form of a path.
  • Copies a file to a new location.
  • Creates a new, empty directory at the provided path
  • Recursively create a directory and all of its parent components 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.