Another option that was not mentioned was to use btoa/atob in the same manner as uuencode/uudecode. btoa expands data 25% vs 35% for uuencode, which could be a significant difference for you. The sources for btoa/atob come with the compress distribution.