---
title: "file(contentType:destinationDirectory:)"
framework: appintents
role: symbol
role_heading: Instance Method
path: "appintents/intentfile/file(contenttype:destinationdirectory:)"
---

# file(contentType:destinationDirectory:)

Requests an IntentFile representation as a file url.

## Declaration

```swift
func file(contentType: UTType, destinationDirectory: URL? = nil) async throws -> (fileURL: URL, openedInPlace: Bool)
```

## Parameters

- `contentType`: A content type of the returned data.
- `destinationDirectory`: The directory the file should be copied to, if no directory is provided the file is opened in place.

## Discussion

Discussion If a destination directory is not given the file is opened in place, falling back to a temporary directory if this fails. If the file is not opened in place and a destination directory is used it is the caller’s responsibility to remove the file.
