Skip to content

Configuration

Paul Joiner edited this page Jan 21, 2022 · 4 revisions

💡 NOTE: This feature is available starting with version 0.5.0 of the library.

The library now has a pattern for configuring various internal classes to adapt to the user's needs. Configuration parameters are set using a lambda in the Archive factory as follows. Use the generic Add method of the FactoryConfiguration class to add each configuration class.

var factory = new DefaultFactory(cfg =>
{
    cfg.Add<FileReaderConfiguration>(cfg => cfg.BufferSize = 1024);
});

using(var archive = new ArchiveReader(path, factory))
{
    ...
}

The following configuration classes and settings may be set. If a class is not set then the default values will be used.

Class Property Default Description
FileReaderConfiguration BufferSize 65536 Integer value for the file reader buffer size. This can be increased to improve file reader preformance at the cost of using extra memory
RowFactoryConfiguration Strategy Lazy An enumeration of row factory types. May be one of
  • Lazy - Reads fields as they are consumed. Use this when consuming fields in index order or only reading some of the fields in a row.
  • Greedy - Parses all fields in a row and stores them in an array. Use this strategy when consuming all fields in random or reverse index order.
ArchiveFolderConfiguration OutputPath null Allows user to specify where to unzip an archive. Leave null to use a temp path.
ShouldCleanup true Allows user to control whether the unzipped folder should be cleaned up after the ArchiveReader is disposed. If OutputPath is null then this is ignored and set to true to automatically clean up any temp folders
Overwrite true If the directory or files already exist then ovewrite. If false then System.IO.IOException is thrown.