Skip to content

Instantly share code, notes, and snippets.

@Chrisso
Created December 13, 2011 12:52
Show Gist options
  • Save Chrisso/1472033 to your computer and use it in GitHub Desktop.
Save Chrisso/1472033 to your computer and use it in GitHub Desktop.
C# Base64-Encoder
using System;
using System.IO;
public class Base64EncodeApp
{
public static void Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine("usage: base64-encode.exe <filename>");
return;
}
using (FileStream fs = File.OpenRead(args[0]))
{
byte[] data = new byte[fs.Length];
fs.Read(data, 0, (int)fs.Length);
Console.WriteLine(Convert.ToBase64String(data));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment