[][src]Function tokio_fs::read

pub async fn read<P>(path: P) -> Result<Vec<u8>> where
    P: AsRef<Path>, 

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());