private void SaveCompressedFile(string sourceFilePath, string compressedFilePath) { using var sourceFileStream = _fileStream.CreateFileStream(sourceFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); using var targetCompressedFileStream = _file.OpenWrite(compressedFilePath); var tarWriterOptions = new TarWriterOptions(CompressionType.LZip, true); using var targetWriter = _tarWriter.CreateTarWriter(targetCompressedFileStream, tarWriterOptions); targetWriter.Write(Path.GetFileName(sourceFilePath), sourceFileStream); }