reads first the full file and then read byte by byte, much faster than using .read() but still in the order of tens of seconds over the MAD server
clean up function not used