<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppleArchive",
  "identifier" : "/documentation/AppleArchive/ArchiveStream/convertStream(writingTo:insertKeySet:removeKeySet:selectUsing:flags:threadCount:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Apple Archive",
      "AppleArchive"
    ],
    "preciseIdentifier" : "s:12AppleArchive0B6StreamC07convertC09writingTo12insertKeySet06removehI011selectUsing5flags11threadCountACSgAC_AA0B6HeaderC05FieldhI0CAoM18EntryMessageStatusVAM0rS0V_6System8FilePathVAM0R10FilterDataOSgtcSgAA0B5FlagsVSitFZ"
  },
  "title" : "convertStream(writingTo:insertKeySet:removeKeySet:selectUsing:flags:threadCount:)"
}
-->

# convertStream(writingTo:insertKeySet:removeKeySet:selectUsing:flags:threadCount:)

Opens a convert output archive stream.

```
static func convertStream(writingTo stream: ArchiveStream, insertKeySet: ArchiveHeader.FieldKeySet, removeKeySet: ArchiveHeader.FieldKeySet, selectUsing filter: ArchiveHeader.EntryFilter? = nil, flags: ArchiveFlags = [], threadCount: Int = 0) -> ArchiveStream?
```

## Parameters

`stream`

The stream that receives the converted archive stream.

`insertKeySet`

A set of keys to fields that the operation inserts into the converted archive.

`removeKeySet`

A set of keys to fields that the operation removes from the converted archive.

`filter`

A closure that’s called for each entry that’s received by the stream.

`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

A new archive stream.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)