I have a base64 encoded string.
How can I write this base64 encoded string to a file?
To decode a file with contents that are base64 encoded, you simply provide the path of the file with the --decode flag. As with encoding files, the output will be a very long string of the original file. You may want to output stdout directly to a file.
In JavaScript there are two functions respectively for decoding and encoding Base64 strings: btoa() : creates a Base64-encoded ASCII string from a "string" of binary data ("btoa" should be read as "binary to ASCII"). atob() : decodes a Base64-encoded string("atob" should be read as "ASCII to binary").
Try this:
File.WriteAllBytes(@"c:\yourfile", Convert.FromBase64String(yourBase64String));
As a first pointer, check out MSDN's documentation on the XmlTextreader's ReadBase64 Method... http://msdn.microsoft.com/en-us/library/system.xml.xmltextreader.readbase64.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With