开发者

creating file from returned byte array via WCF Rest Service

开发者 https://www.devze.com 2023-04-05 17:49 出处:网络
I am working on creating a WCF rest service. I have a function that will return a byte array of a file 开发者_高级运维created by the service. I was wondering how I can create this file, from the byte

I am working on creating a WCF rest service. I have a function that will return a byte array of a file 开发者_高级运维created by the service. I was wondering how I can create this file, from the byte array on the client side. This is in C#.


Simply write all received bytes to the file:

File.WriteAllBytes("filename.bin", receivedBytesArray);

Save stream to file:

Stream receivedStream = // do some staff to receive stream

using (FileStream stream = File.OpenWrite("myfilepath.bin"))
{
    receivedStream.CopyTo(stream);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号