Skip to content

Solid.Http.Extensions.SharpCompress Initialization

HX-Rd edited this page May 9, 2018 · 11 revisions

Initialization

Solid.Http.Extensions.Zip is designed to work with Solid.Http and Solid.Http.Core.

SharpCompressOptions

  • ReaderOptions This is the SharpCompress.Readers.ReaderOptions and will be used when the archives are constructed
  • MimeTypes The mimetypes that are associated with the extension. If the mimetypes are encountered, the extension will try to create the requested Archive. There are some default mimetypes that are provided by default. These are
"application/zip",
"application/x-rar-compressed",
"application/x-tar",
"application/x-7z-compressed"

With Solid.Http.Core

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services
            .AddSolidHttpCore()
            .AddSharpCompress();
    }
}
public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services
            .AddSolidHttpCore()
            .AddSharpCompress(
                new SharpCompressOptions(
                    options: new ReaderOptions
                    {
                        LookForHeader = false
                    },
                    mimeTypes: new List<string>()
                    {
                        "application/octet-stream"
                    },
                    useDefaultMimeTypes: false,
                    tarArchivesAreGziped: false
                )
            );
    }
}

With Solid.Http

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services
            .AddSolidHttp()
            .AddSharpCompress();
    }
}
public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services
            .AddSolidHttp()
            .AddSharpCompress(
                new SharpCompressOptions(
                    options: new ReaderOptions
                    {
                        LookForHeader = false
                    },
                    mimeTypes: new List<string>()
                    {
                        "application/octet-stream"
                    },
                    useDefaultMimeTypes: false,
                    tarArchivesAreGziped: false
                )
            );
    }
}

Clone this wiki locally