# Manage Downloads

Use the following scripts to control routing data and map tile download tasks for a region:

1.  To pause a download that supports pausing:

```swift
try await NBNavigation.pauseRegionDownload(regionId: regionId)
```

1.  To resume a download:

```swift
try await NBNavigation.resumeRegionDownload(regionId: regionId)
```

1.  To cancel (stop) a download:

```swift
try await NBNavigation.cancelRegionDownload(regionId: regionId)
```

1.  To delete routing and the map data for a region:

```swift
try await NBNavigation.deleteRegionAllData(regionId: regionId)
```

| Operation | Effect | Deletes completed data |
| --- | --- | --- |
| pause | Pauses downloads that support pausing | No |
| resume | Continues paused or resumable downloads | No |
| cancel | Cancels or stops the queued or running tasks | Does not guarantee deletion of existing complete packages |
| delete | Deletes local routing and map data for the region | Yes |

_pauseRegionDownload_ and _resumeRegionDownload_ act on both routing and map tasks but return the routing-side result.

Use _pauseRegionWithDetails_ and _resumeRegionWithDetails_ to inspect both subtask results.

Use _manageOfflineRegion_ to control only one dataset.

> **Non-transactional Behavior:** `cancel` _cancels routing work before map work, and_ `delete` _removes routing data before map data. If the second step fails, the first step is not rolled back. After the operation, read progress and installed packages again and allow the user to retry the failed subtask._
