<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPasteboard/PasteboardType/fileContentsType(forPathExtension:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:@F@NSCreateFileContentsPboardType"
  },
  "title" : "fileContentsType(forPathExtension:)"
}
-->

# fileContentsType(forPathExtension:)

Returns a pasteboard type based on the passed file type.

```
static func fileContentsType(forPathExtension fileType: String) -> NSPasteboard.PasteboardType!
```

## Discussion

Returns an <doc://com.apple.documentation/documentation/Foundation/NSString> to a pasteboard type representing a file’s contents based on the supplied string `fileType`. `fileType` should generally be the extension part of a filename. The conversion from a named file type to a pasteboard type is simple; no mapping to standard pasteboard types is attempted.

---

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)