<!--
{
  "availability" : [
    "macOS: 10.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSURLDownload",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLDownload"
  },
  "title" : "NSURLDownload"
}
-->

# NSURLDownload

An object that downloads a resource asynchronously and saves the data to a file.

```
class NSURLDownload
```

## Overview> Important:
> This API is considered legacy. Use ``doc://com.apple.foundation/documentation/Foundation/URLSession`` instead.

The interface for [`NSURLDownload`](/documentation/Foundation/NSURLDownload) provides methods to initialize a download, set the destination path and cancel loading the request.

The delegate object assigned to each instance of this class should implement the methods defined by the [`NSURLDownloadDelegate`](/documentation/Foundation/NSURLDownloadDelegate) protocol. These methods provide the delegate with the current status of in-progress asynchronous downloads and allow the delegate to customize the URL loading process. These delegate methods are called on the thread that started the asynchronous load operation for the associated [`NSURLDownload`](/documentation/Foundation/NSURLDownload) object.

## Topics

### Creating and configuring a download instance

[`init(request:delegate:)`](/documentation/Foundation/NSURLDownload/init(request:delegate:))

Returns an initialized URL download for a URL request and begins to download the data for the request.

[`setDestination(_:allowOverwrite:)`](/documentation/Foundation/NSURLDownload/setDestination(_:allowOverwrite:))

Sets the destination path of the downloaded file.

### Resuming partial downloads

[`canResumeDownloadDecoded(withEncodingMIMEType:)`](/documentation/Foundation/NSURLDownload/canResumeDownloadDecoded(withEncodingMIMEType:))

Returns whether a URL download object can resume a download that was decoded with the specified MIME type.

[`init(resumeData:delegate:path:)`](/documentation/Foundation/NSURLDownload/init(resumeData:delegate:path:))

Returns an initialized NSURLDownload object that will resume downloading the specified data to the specified file and begins the download.

[`resumeData`](/documentation/Foundation/NSURLDownload/resumeData)

Returns the resume data for a download that is not yet complete.

[`deletesFileUponFailure`](/documentation/Foundation/NSURLDownload/deletesFileUponFailure)

Returns whether the receiver deletes partially downloaded files when a download stops prematurely.

### Canceling a download

[`cancel()`](/documentation/Foundation/NSURLDownload/cancel())

Cancels the receiver’s download and deletes the downloaded file.

### Getting download properties

[`request`](/documentation/Foundation/NSURLDownload/request)

Returns the request that initiated the receiver’s download.

[`deletesFileUponFailure`](/documentation/Foundation/NSURLDownload/deletesFileUponFailure)

Returns whether the receiver deletes partially downloaded files when a download stops prematurely.



---

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)