LiteCDF 5.2.0

dotnet add package LiteCDF --version 5.2.0
                    
NuGet\Install-Package LiteCDF -Version 5.2.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="LiteCDF" Version="5.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LiteCDF" Version="5.2.0" />
                    
Directory.Packages.props
<PackageReference Include="LiteCDF" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LiteCDF --version 5.2.0
                    
#r "nuget: LiteCDF, 5.2.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.
#:package LiteCDF@5.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LiteCDF&version=5.2.0
                    
Install as a Cake Addin
#tool nuget:?package=LiteCDF&version=5.2.0
                    
Install as a Cake Tool

LiteCDF

logo

NuGet

A high performance reader of compound document format (CDF) files.

Usage

Opening a compound document:

CompoundDocument document = Cdf.Open(@"C:\path\to\file.cf");

This will return a CompoundDocument object exposing all the directory entries contained in the file through its DirectoryEntries property. There are overloads available that can read from a Stream or a byte[] object for extra convenience.

Each entry is a CompoundDocument.DirectoryEntry exposing its Id, Name, Type (an EntryType of Storage, Stream or RootStorage) and IsRootStorageDescendant. If the entry is a stream, its data is lazily read on first access via the Stream property:

foreach (var entry in document.DirectoryEntries)
{
    Console.WriteLine($"{entry.Name} ({entry.Type})");

    if (entry.Type == CompoundDocument.DirectoryEntry.EntryType.Stream)
    {
        byte[]? data = entry.Stream;
    }
}

If you just want to quickly extract a stream, you can use the OpenAndReadStream method instead. Its second parameter is a predicate that specifies how to match the name of the stream to extract:

byte[]? stream = Cdf.OpenAndReadStream(@"C:\path\to\file.cf", n => n == "MyStream");

This method will return as soon as a matching stream has been found, or null if no stream matched.

To extract more than one stream that matches a specific pattern, you can use the OpenAndReadMultipleStreams:

ReadOnlyDictionary<string, byte[]> streams = Cdf.OpenAndReadMultipleStreams(@"C:\path\to\file.cf", n => n.EndsWith("Stream"));

This will return any matching streams in the form of a read-only dictionary where each key-value pair represents the name and the associated byte array of the stream, respectively.

Restricting to root storage descendants

Every method accepts an optional final bool parameter (rootStorageDescendantsOnly, or rootStorageDescendantOnly on OpenAndReadStream) that, when set to true, restricts the results to entries that are descendants of the root storage:

CompoundDocument document = Cdf.Open(@"C:\path\to\file.cf", rootStorageDescendantsOnly: true);
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
5.2.0 48 6/4/2026
5.1.1 192 12/11/2025
5.0.0 325 11/16/2025
4.0.0 358 6/14/2024
3.0.2 761 6/19/2022
2.0.0 734 11/10/2020
1.3.0 734 7/5/2020
1.2.8 721 7/2/2020
Loading failed

5.2.0 Further performance improvements and bug fixes