read chunks from stream rather than one byte at a time