字节数组到Zip文件 [英] Byte Array to Zip File

查看:103
本文介绍了字节数组到Zip文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个来自数据库的byte []我需要转换成.zip文件。



请帮助!!



谢谢,小吃



快乐编码

解决方案

字节数组可以是任何东西。它是如何生成的/它包含什么?

如果它是从zip流或zip文件生成的,你只需要用BinaryWriter将它写入磁盘。


尝试:

 File.WriteAllBytes( @  D:\Temp \ Myfile.zip,dataBytesFromDB); 

如果数据是zip文件,则会重新创建它。如果不是,你实际要求的是如何创建一个包含这个字节数组的新zip文件?然后看看这个: http://stackoverflow.com/questions/17217077/create-zip-file -from-byte [ ^


Hi All,
I have a byte[] from database which I need to convert into .zip file.

Please Help !!

Thanks, Tapas

"Happy Coding"

解决方案

A byte array can be anything. How was it generated/what does it contain?
If it was generated from a zip stream or zip file, you just need to write it to disk with a BinaryWriter.


Try:

File.WriteAllBytes(@"D:\Temp\Myfile.zip", dataBytesFromDB);

If the data is a zip file, this will recreate it. If it isn't, and what you are actually asking for is "how to I create a new zip file containing this array of bytes?" then look at this: http://stackoverflow.com/questions/17217077/create-zip-file-from-byte[^]


这篇关于字节数组到Zip文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆