DEV Community

Samandar Ravshanov
Samandar Ravshanov

Posted on

Convert integers to a Base64-encoded VLQ string

More: https://en.wikipedia.org/wiki/Variable-length_quantity

from functorflow import ff

r = ff('vlq').encode(123)
print(r) # '2H'

r = ff('vlq').encode([ 123, 456, 789 ])
print(r) # '2HwcqxB'

r = ff('vlq').decode( '2HwcqxB' )
print(r) # [ 123, 456, 789 ]
Enter fullscreen mode Exit fullscreen mode

Top comments (0)