import lzstring
import requests
txt = open("lordoftherings.txt").read()
len(txt)
x = lzstring.LZString()
%%time
s = x.compressToBase64(txt)
print("length", len(s))
with open("lordoftherings_compressed.txt", "w") as f:
f.write(s)
!ls -lah lord*
<script type="text/javascript" src="lz-string.min.js"></script>
<script>
fetch('<url>/lordoftherings_compressed.txt').then(rs => rs.text())
.then((data) => {
string = LZString.decompressFromBase64(data);
document.querySelector('body').innerHTML = string
})
</script>