Skip to content

Commit

Permalink
feat:insert newlines in base64 encoding by default
Browse files Browse the repository at this point in the history
  • Loading branch information
JinnLynn committed Jun 7, 2024
1 parent 5f72d5c commit e88cc2c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/genpac/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,11 @@ def exit_success(*args):
sys.exit()


def b64encode(data):
def b64encode(data, newline=True):
if isinstance(data, str):
data = data.encode()
return base64.b64encode(data).decode()
encoded = base64.encodebytes(data) if newline else base64.b64encode(data)
return encoded.decode()


def b64decode(s):
Expand Down

0 comments on commit e88cc2c

Please sign in to comment.