[][src]Function tokio::fs::read

pub async fn read(path: impl AsRef<Path>) -> Result<Vec<u8>>
This is supported on feature="fs" only.

Creates a future which will open a file for reading and read the entire contents into a buffer and return said buffer.

This is the async equivalent of std::fs::read.

Examples

use tokio::fs;

let contents = fs::read("foo.txt").await?;
println!("foo.txt contains {} bytes", contents.len());