# FileManager Extension Reference



## Scope and provenance

- Product: mobile
- Status: Imported reference snapshot. Import date is not a verification date or guarantee of current release support.
- SDK version: Not declared for this page. Versions in examples must not be assumed current.
- Environment: Page-specific. Confirm the environment host, credentials, and service configuration; do not infer them from another product.
- Source: https://documentation.idmission.com/identity/iOS-SDK-2/Extensions/FileManager.html
- Imported at: 2026-10-25T05:00:44.899Z
- Canonical page: https://docs.idmission.com/mobile/reference/ios/Extensions/FileManager
- Agent index: https://docs.idmission.com/llms.txt

---

<a id="filemanager"></a>

# FileManager

```
extension FileManager
```

- <a id="/s:So13NSFileManagerC17IDentitySDK_SwiftE7zipItem2at2to16shouldKeepParent17compressionMethod8progressy10Foundation3URLV_ALSbAC011CompressionN0OSo10NSProgressCSgtKF"></a>

  <a id="//apple_ref/swift/Method/zipItem(at:to:shouldKeepParent:compressionMethod:progress:)"></a>

  `zipItem(at:to:shouldKeepParent:compressionMethod:progress:)`

  Zips the file or directory contents at the specified source URL to the destination URL.

  If the item at the source URL is a directory, the directory itself will be represented within the ZIP `Archive`. Calling this method with a directory URL `file:///path/directory/` will create an archive with a `directory/` entry at the root level. You can override this behavior by passing `false` for `shouldKeepParent`. In that case, the contents of the source directory will be placed at the root of the archive.

  Throws

  Throws an error if the source item does not exist or the destination URL is not writable.

  <a id="declaration"></a>

  #### Declaration

  Swift

  ```
  public func zipItem(at sourceURL: URL, to destinationURL: URL,
                      shouldKeepParent: Bool = true, compressionMethod: CompressionMethod = .none,
                      progress: Progress? = nil) throws
  ```

  <a id="parameters"></a>

  #### Parameters

  |                     |                                                                                                                           |
  | ------------------- | ------------------------------------------------------------------------------------------------------------------------- |
  | `sourceURL`         | The file URL pointing to an existing file or directory.                                                                   |
  | `destinationURL`    | The file URL that identifies the destination of the zip operation.                                                        |
  | `shouldKeepParent`  | Indicates that the directory name of a source item should be used as root element within the archive. Default is `true`.  |
  | `compressionMethod` | Indicates the `CompressionMethod` that should be applied. By default, `zipItem` will create uncompressed archives.        |
  | `progress`          | A progress object that can be used to track or cancel the zip operation.                                                  |

- <a id="/s:So13NSFileManagerC17IDentitySDK_SwiftE9unzipItem2at2to9skipCRC328progress17preferredEncodingy10Foundation3URLV_ALSbSo10NSProgressCSgSSAJE0N0VSgtKF"></a>

  <a id="//apple_ref/swift/Method/unzipItem(at:to:skipCRC32:progress:preferredEncoding:)"></a>

  `unzipItem(at:to:skipCRC32:progress:preferredEncoding:)`

  Unzips the contents at the specified source URL to the destination URL.

  Throws

  Throws an error if the source item does not exist or the destination URL is not writable.

  <a id="declaration-2"></a>

  #### Declaration

  Swift

  ```
  public func unzipItem(at sourceURL: URL, to destinationURL: URL, skipCRC32: Bool = false,
                        progress: Progress? = nil, preferredEncoding: String.Encoding? = nil) throws
  ```

  <a id="parameters-2"></a>

  #### Parameters

  |                     |                                                                                  |
  | ------------------- | -------------------------------------------------------------------------------- |
  | `sourceURL`         | The file URL pointing to an existing ZIP file.                                   |
  | `destinationURL`    | The file URL that identifies the destination directory of the unzip operation.   |
  | `skipCRC32`         | Optional flag to skip calculation of the CRC32 checksum to improve performance.  |
  | `progress`          | A progress object that can be used to track or cancel the unzip operation.       |
  | `preferredEncoding` | Encoding for entry paths. Overrides the encoding specified in the archive.       |

<a id="footer"></a>

© 2024 [IDmission](https://www.idmission.com/). All rights reserved. (Last updated: 2024-08-27)

Generated by [jazzy ♪♫ v0.14.2](https://github.com/realm/jazzy), a [Realm](https://realm.io/) project.
