我必须创建多个缩略图并保存在 c# 中的 amazon s3 上。我找不到只能从源文件从内存流创建缩略图的库。但没有文件源,我只有上传的流,我不想在本地保存文件。
谢谢你的帮助!
我正在从db读取二进制数据并使用代码将其转换为文本.
public String BinaryToText(byte[] data)
{
System.Text.Encoding encEncoder = System.Text.ASCIIEncoding.ASCII;
return encEncoder.GetString(data);
}
Run Code Online (Sandbox Code Playgroud)
上面的过程正常工作但是当转换二进制文件> = 85mb时,会显示OutOfMemoryException.如何将大型二进制数据转换为字符串而不会出错.
我使用以下函数将二进制数据转换为文本
public string BinaryToText(byte[] data)
{
MemoryStream stream = new MemoryStream(data);
StreamReader reader = new StreamReader(stream, encoding.UTF8);
string text = reader.ReadTod();
return text;
}
Run Code Online (Sandbox Code Playgroud)
但OutOfMemoryException显示30Mb数据.如何解决这个问题并使用这个或更好的方法转换大于100Mb的数据?