ZimReaderSharp 1.0.0

dotnet add package ZimReaderSharp --version 1.0.0                
NuGet\Install-Package ZimReaderSharp -Version 1.0.0                
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="ZimReaderSharp" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ZimReaderSharp --version 1.0.0                
#r "nuget: ZimReaderSharp, 1.0.0"                
#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 ZimReaderSharp as a Cake Addin
#addin nuget:?package=ZimReaderSharp&version=1.0.0

// Install ZimReaderSharp as a Cake Tool
#tool nuget:?package=ZimReaderSharp&version=1.0.0                

ZimReaderSharp - A Robust Library for reading ZIM files

NuGet

ZimReaderSharp provides a streamlined interface to efficiently read and handle ZIM files. With support for multiple compression types—including BZip2, LZMA, and ZStd—this library prioritizes performance, loading only necessary data on-the-fly for rapid startup.

Installation

To incorporate ZimReaderSharp into your project, choose one of the following methods:

.NET CLI

dotnet add package ZimReaderSharp

NuGet Package Manager

Install-Package ZimReaderSharp

For detailed package information, visit ZimReaderSharp on NuGet.

Key Usages

The main class ZimFile offers an interface for accessing all the entries in a given ZIM file. You can either iterate over them, retrieve them by URL or by retrieve them by index.

Given a returned Entry, it has the following properties:

  • Format: An object containing all the metadata for a given entry: Namespace, Revision, Url, Title, Parameter.

  • Index: The index of the entry in the file.

  • IsRedirect: If the user requested to not follow redirects, then this flag will be true and data will be null.

  • Data: A byte[] containing the data of the entry

  • Mime: A string representation of the mime type.

Sample usage

Here is an example to read all the HTML entries in a given ZIM file:

string filename = "wikipedia_en_all_nopic_2023-06.zim";

using var zimFile = new ZimFile(filename);

foreach (var (index, mime) in zimFile.IterateArticles()) {
    if (mime == "text/html") {
        var entry = zimFile.GetArticleByIndex(index, fFollowRedirect: false);
        if (entry.IsRedirect) continue;

        string html = Encoding.UTF8.GetString(entry.Data);
    }
}

Or, here is an example to get an entry by a URL:

string filename = "wikipedia_en_all_nopic_2023-06.zim";

using var zimFile = new ZimFile(filename);

var entry = zimFile.GetEntryByUrl('A', "some_url");
Console.WriteLine(entry.Format.Title);
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0 180 11/25/2023