Skip to content

Instantly share code, notes, and snippets.

View osysltd's full-sized avatar
🤙
Looking for new opportunities

Osys osysltd

🤙
Looking for new opportunities
View GitHub Profile
@osysltd
osysltd / gist:75099fcff460568eef2f05d27f68030d
Created June 23, 2021 21:07 — forked from t2psyto/gist:f5453707d2658173715f49293d096fe5
powershell oneliner for encode/decode base64 to file
# encode from binary file to base64txt
powershell -C "& {$outpath = (Join-Path (pwd) 'out_base64.txt'); $inpath = (Join-Path (pwd) 'data.jpg'); [IO.File]::WriteAllText($outpath, ([convert]::ToBase64String(([IO.File]::ReadAllBytes($inpath)))))}"
# decode from base64txt to binary file
powershell -C "& {$outpath = (Join-Path (pwd) 'outdata2.jpg'); $inpath = (Join-Path (pwd) 'out_base64.txt'); [IO.File]::WriteAllBytes($outpath, ([convert]::FromBase64String(([IO.File]::ReadAllText($inpath)))))}"