replace readavailable with eof/nb_available/readbytes, as suggested by @vtjnash in JuliaLang/julia#7478