public static byte[] ReadFully(this Stream input) { using (var ms = new MemoryStream()) { input.CopyTo(ms); return ms.ToArray(); } }