YGZipLib 1.0.13

There is a newer version of this package available.
See the version list below for details.
dotnet add package YGZipLib --version 1.0.13                
NuGet\Install-Package YGZipLib -Version 1.0.13                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YGZipLib" Version="1.0.13" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YGZipLib --version 1.0.13                
#r "nuget: YGZipLib, 1.0.13"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install YGZipLib as a Cake Addin
#addin nuget:?package=YGZipLib&version=1.0.13

// Install YGZipLib as a Cake Tool
#tool nuget:?package=YGZipLib&version=1.0.13                

YGZipLib

YGZipLib is a compression/decompression library for ZIP archives.

Features

Compression/decompression processes are performed in multiprocessing
AES encryption support

Usage

  • Compression method
    using YGZipLib;

    public void Compress()
    {
         using(ZipArcClass zipArc = new ZipArcClass(@"R:\example.zip"))
         {
             // Compression Option Setting
             zipArc.EncryptionOption = ZipArcClass.ENCRYPTION_OPTION.AES256;
             zipArc.Password = "password";
             // single file compression
             zipArc.AddFilePath(@"R:\example_file.txt");
             // directory compression
             zipArc.AddDirectory(@"R:\example_dir");
             // Finish call
             zipArc.Finish();
         }
     }
  • Decompression Method
    using YGZipLib;
    using System.Collections.Generic;
    using System.IO;

    public void Decompress()
    {
        using(UnZipArcClass unzipArc = new UnZipArcClass(@"R:\example.zip"))
        {
            // Set password if the file is encrypted.
            unzipArc.Password = "password";

            // --- Processed per file ---
            // Obtaining a list of files in a ZIP archive
            List<UnZipArcClass.CentralDirectoryInfo> dirList = unzipArc.GetFileList;
            // Loop and process
            dirList.FindAll(d => d.IsDirectory == false).ForEach(d => unzipArc.PutFile(d, Path.Combine(@"R:\uncompressdir", d.FileName)));

            // --- batch directory processing ---
            unzipArc.ExtractAllFiles(new DirectoryInfo(@"R:\uncompressdir"));
        }
    }
  • Output ZIP file as Stream by web service, etc.
    using YGZipLib;
    using System.IO;

    /// <summary>
    /// Example of sending a ZIP file via a web service, etc.
    /// </summary>
    /// <param name="resStream"></param>
    public async void SendZipFile (Stream resStream)
    {
        using(ZipArcClass zip = new ZipArcClass(resStream))
        {
            await zip.AddFileStreamAsync("example1.dat", stream1);
            await zip.AddFileStreamAsync("/dir/example2.dat", stream2);
            await zip.FinishAsync();
        }
    }
  • Async
    // Example
    List<Task> taskList = new List<Task>();
    taskList.Add(zip.AddFilePathAsync(@"D:\example1.txt"));
    taskList.Add(zip.AddFilePathAsync(@"D:\example2.txt"));
    taskList.Add(zip.AddFilePathAsync(@"D:\example3.txt"));
    Task t = Task.WhenAll(taskList);
  • Other Settings

ZipArcClass

    // Processing multiplicity and working directory
    // ProcessorCount or 4, whichever is smaller. 0 is the default value.
    // For slow storage, process multiplexing should be lowered.
    // The working directory should be a fast device; if null is specified, it is automatically set from the environment.
    YGZipLib.ZipArcClass zip = new ZipArcClass(@"D:\zipfile.zip", 8, @"R:\temp");

    // Only archive without compression
    zip.CompressionOption = ZipArcClass.COMPRESSION_OPTION.NOT_COMPRESSED;

    // If you want the file to be uncompressed, specify the extension with a regular expression.
    zip.DontCompressExtRegExList.Add(new Regex("jpg", RegexOptions.IgnoreCase));
    zip.DontCompressExtRegExList.Add(new Regex("xls.*", RegexOptions.IgnoreCase));

    // Encryption Algorithms
    zip.EncryptionOption = ZipArcClass.ENCRYPTION_OPTION.TRADITIONAL;   // default
    zip.EncryptionOption = ZipArcClass.ENCRYPTION_OPTION.AES256;        // AES 256bit

    // The file name to be stored is the code page obtained from System.Text.Encoding.Default.CodePage.
    // Default.CodePage is utf8 except for .net Framework, so set the appropriate encoding if necessary.
    // Non-.net Framework environments may require the encoding provider to be registered at the beginning of the program.
    // System.Text.Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
    zip.ZipFileNameEncoding = System.Text.Encoding.GetEncoding("shift-jis");

UnZipArcClass

    // Get list of stored files.
    List<YGZipLib.UnZipArcClass.CentralDirectoryInfo> dirList = unzip.GetFileList;

    // TextEncodings of stored files.
    // See ZipArcClass
    unzip.ZipFileNameEncoding = System.Text.Encoding.GetEncoding("shift-jis");

    // Processing multiplicity and working directory
    // See ZipArcClass
    YGZipLib.UnZipArcClass unzip = new UnZipArcClass(@"D:\zipfile.zip", 4, @"R:\temp");

Note

Finish should be called at the end when creating a ZIP archive.

License

"YGZipLib" is under MIT license

This library includes the work that is distributed in the Apache License 2.0.
The Deflate64 code included in YGZipLib is based on the following java source from Apache Commons Compress™.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.25 641 3/16/2024
1.0.24 303 1/18/2024
1.0.23 143 1/16/2024
1.0.22 203 11/30/2023
1.0.19 260 6/16/2023
1.0.18 151 5/28/2023
1.0.17 384 5/18/2023
1.0.16 157 4/24/2023
1.0.13 212 4/10/2023
1.0.12 220 3/31/2023
1.0.11 221 3/29/2023