-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Files in Base64 Cmdlets #16
Comments
If there was simply a get-content 'kitten.png' -asbytestream | convertto-base64 > base64.txt I would agree that it's more intuitive to have a |
Maybe not. The only area I can see this being an issue is the txt file is encoded (for example CJK) and the user expecting base64 to be encoding the string contents of the file as UTF-8 for the destination. Base64 encoding the byte array would maintain CJK. Another concern is utf-8 BOM. In any case... if it is properly documented that -Path only encodes raw file bytes it could be acceptable.. or if a source encoding can be supplied and if present decode the file to a string and then utf-8+base64 encode. This brings up another topic I debated mentioning.. which is destination encoding... a few endpoints I have worked with expect the base64 decoded string to be encodings other than utf-8. *shrugs
Needed? No. But it is more convenient if I am dealing with nothing but files. But it's not a deal-breaker for me. |
RE: get-content 'kitten.png' -asbytestream | convertto-base64 > base64.txt That's my point... a ton of boilerplate code. I don't have as many scenarios where I'm just base64 encoding string from the run time. I'm primarily working with files. In my own cmdlets have made for this, I included file encoding to make the code much cleaner and easier to follow. |
Thinking about Still not a deal-breaker, but something else to consider. |
I think that's a good enough reason to have |
More often than not, my use cases for base64 involve files. This leads to a large amount of boilerplate code. This could be reduced if support for reading from and writing to files is added to the Base64 cmdlets.
As a user, I would like to use ConvertFrom-Base64 to store the results in a file.
As a user, I would like to convert UTF-8 text contained in a file to Base64 using ConvertTo-Base64
As a user, I would like to convert a file containing binary data to Base64 using ConvertTo-Base64
The text was updated successfully, but these errors were encountered: