Read entire file as u8


I’m having trouble googling this. Is there a builtin function that takes a &str or a std::fs::File, and return the entire file as Vec ?


Yes, a free function in the fs module:


@scottmcm : Great; thanks! It even links to read_to_end which turns out to work even better in this case. Thanks!