Skip to content

Zip Class ​

Definition ​

Provides wrapper methods for compressing and decompressing files, byte arrays, etc

  • Namespace: JASE.Compression
  • Assembly: JASE.Compression.dll

Methods ​

NameDescription
void AddFilesToZip(string zipFile, IEnumerable<string> files, CompressionLevel compression = null, Encoding encoding = null, bool replaceIfExist = null)Add a list of files to an existing ZipFile
void AddFileToZip(ref byte[] zipFileContent, byte[] content, string filename, CompressionLevel compression = null, Encoding encoding = null, bool replaceIfExist = null)Add a single file to an existing ZipFile
void AddFileToZip(string zipFile, byte[] content, string filename, CompressionLevel compression = null, Encoding encoding = null, bool replaceIfExist = null)Add a single file to an existing ZipFile
void AddFileToZip(string zipFile, string file, CompressionLevel compression = null, Encoding encoding = null)Add a single file to an existing ZipFile
byte[] Compress(byte[] bytes, CompressionLevel compression = null, string entryName = null, Encoding encoding = null)Compress a byte array
void CreateFromDirectory(string directory, string destinationFile, CompressionLevel compression = null, bool includeBase = null)Create and save a Zip file of the specified directory contents
void CreateZipFile(string zipFile, IEnumerable<string> files, CompressionLevel compression = null, Encoding encoding = null)Create a new ZipFile containing a list of files
void CreateZipFile(string zipFile, byte[] content, string filename, CompressionLevel compression = null, Encoding encoding = null)Create a new ZipFile containing the byte[]
byte[] CreateZipFileInMemory(IEnumerable<ZipFileEntry> entries, CompressionLevel compression = null, Encoding encoding = null)Create a new ZipFile in memory containing multiple files and return the byte[]
byte[] CreateZipFileInMemory(byte[] content, string filename, CompressionLevel compression = null, Encoding encoding = null)Create a new ZipFile in memory and return the byte[]
byte[] Decompress(byte[] bytes, string entryName = null, ZipBombOptions options = null, Encoding encoding = null)Decompress a previously compressed byte array
IList<ZipFileEntry> DecompressFiles(byte[] bytes, ZipBombOptions options = null, Encoding encoding = null)Decompress a compressed byte array
void ExtractToDirectory(string zipFile, string directory, ZipExtractionOptions options = null)Extracts contents for specified zip file into the specified directory
bool IsZipBomb(Stream stream, ZipBombOptions options = null)Analyze byte array as a zip file and checks for signs that it is a zip bomb
bool IsZipBomb(byte[] bytes, ZipBombOptions options = null)Analyze byte array as a zip file and checks for signs that it is a zip bomb
bool IsZipBomb(string filename, ZipBombOptions options = null)Analyze byte array as a zip file and checks for signs that it is a zip bomb