SaveZstandard

TarArchive.SaveZstandard method (1 of 2)

Saves archive to the stream with Zstandard compression.

public void SaveZstandard(Stream output, TarFormat? format = default)
ParameterTypeDescription
outputStreamDestination stream.
formatNullable`1Defines tar header format. Null value will be treated as USTar when possible.

Exceptions

exceptioncondition
ArgumentNullExceptionoutput is null.
ArgumentExceptionoutput is not writable.

Remarks

output must be writable.

Examples

using (FileStream result = File.OpenWrite("result.tar.zst"))
{
    using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
    {
        using (var archive = new TarArchive())
        {
            archive.CreateEntry("entry.bin", source);
            archive.SaveZstandard(result);
        }
    }
}

See Also


TarArchive.SaveZstandard method (2 of 2)

Saves archive to the file by path with Zstandard compression.

public void SaveZstandard(string path, TarFormat? format = default)
ParameterTypeDescription
pathStringThe path of the archive to be created. If the specified file name points to an existing file, it will be overwritten.
formatNullable`1Defines tar header format. Null value will be treated as USTar when possible.

Examples

using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
{
    using (var archive = new TarArchive())
    {
        archive.CreateEntry("entry.bin", source);
        archive.SaveZstandard("result.tar.zst");
    }
}

See Also