use bytesize instead of length to calculate chunk size