---
title: "compressionStream(appendingTo:flags:threadCount:)"
framework: applearchive
role: symbol
role_heading: Type Method
path: "applearchive/archivebytestream/compressionstream(appendingto:flags:threadcount:)"
---

# compressionStream(appendingTo:flags:threadCount:)

Reopens a compression sequential output stream.

## Declaration

```swift
static func compressionStream(appendingTo compressedStream: ArchiveByteStream, flags: ArchiveFlags = [], threadCount: Int = 0) -> ArchiveByteStream?
```

## Parameters

- `compressedStream`: The output stream that the function reopens and receives the compressed data.
- `flags`: Flags that control the behavior of the operation.
- `threadCount`: The number of worker threads that the operation uses, set to 0 for default.

## Return Value

Return Value A new archive byte stream.

## Discussion

Discussion The operation writes compressed data to the end of the supplied archive byte stream, compressedStream. compressedStream must implement seek(toOffset:relativeTo:), and the read and write functions. The stream that the function returns only implements write(from:) and write(from:atOffset:).

## See Also

### Compressing Data

- [compressionStream(using:writingTo:blockSize:flags:threadCount:)](applearchive/archivebytestream/compressionstream(using:writingto:blocksize:flags:threadcount:).md)
- [withCompressionStream(using:writingTo:blockSize:flags:threadCount:_:)](applearchive/archivebytestream/withcompressionstream(using:writingto:blocksize:flags:threadcount:_:).md)
- [withCompressionStream(appendingTo:flags:threadCount:_:)](applearchive/archivebytestream/withcompressionstream(appendingto:flags:threadcount:_:).md)
