1
good afternoon! I have a file that is saved in bank, and I need to zip this file, when you download it. How do I do it? Thank you very much for your support
1
good afternoon! I have a file that is saved in bank, and I need to zip this file, when you download it. How do I do it? Thank you very much for your support
0
From . NET Framework 4.5 Beta, it is possible to manipulate ZIP files. Example based in this:
using System;
using System.IO;
using System.IO.Compression;
using System.IO.Compression.FileSystem;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
using (FileStream zipToOpen = new FileStream(@"c:\users\exampleuser\Desktop\release.zip", FileMode.Create))
{
using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Create))
{
archive.CreateEntryFromFile(@"c:\users\exampleuser\Desktop\MeuArquivoACompactar.dat", "arquivo.dat");
}
}
}
}
}
opa...thanks for the help. but I did it by Ionic, on account of the version of . net
Browser other questions tagged c# .net zip-file
You are not signed in. Login or sign up in order to post.
already have the code to save the file to disk ? then just use Dotnet.ZIP: example: https://answall.com/q/253856/69359
– Rovann Linhalis
No, I’ll take a look at this link. ?
– Ricardo Soares
straight from the bank comes an array of bytes, stream, ... I don’t know if it works
– Rovann Linhalis
understood... how do I save the database to disk.
– Ricardo Soares
What version of . NET Framework are you using, @Ricardosoares?
– Marcelo Shiniti Uchimura
is 4.0 and unfortunately not Ziparchive support
– Ricardo Soares
With this restriction I think I once used the Dotnetzip library, must have in nuget
– Leandro Angelo
I’ll try with Ionic. Unfortunately I can’t add other components...
– Ricardo Soares
But this lib is compatible with Ionic https://www.nuget.org/packages/Ionic.Zip/
– Leandro Angelo