If you need to use a raster PNG badge, change the '.svg' to '.png' in the link
Refactored flush. Moved creates to when opening a file.
Also made sure that both append and write mode buffer are not larger than 4 Mb.
And removed an extra call to server to check length when opening a file in read mode.
relevant lines covered
hits per line