LiteCDF 5.2.0
dotnet add package LiteCDF --version 5.2.0
NuGet\Install-Package LiteCDF -Version 5.2.0
<PackageReference Include="LiteCDF" Version="5.2.0" />
<PackageVersion Include="LiteCDF" Version="5.2.0" />
<PackageReference Include="LiteCDF" />
paket add LiteCDF --version 5.2.0
#r "nuget: LiteCDF, 5.2.0"
#:package LiteCDF@5.2.0
#addin nuget:?package=LiteCDF&version=5.2.0
#tool nuget:?package=LiteCDF&version=5.2.0
LiteCDF

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 | Versions 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. |
-
net10.0
- BinaryBuffers (>= 5.1.0)
- StreamExtensions (>= 4.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
5.2.0 Further performance improvements and bug fixes