---
title: "CFURLCreateBookmarkDataFromFile(_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfurlcreatebookmarkdatafromfile(_:_:_:)"
---

# CFURLCreateBookmarkDataFromFile(_:_:_:)

Initializes and returns bookmark data derived from a file pointed to by a specified URL.

## Declaration

```swift
func CFURLCreateBookmarkDataFromFile(_ allocator: CFAllocator!, _ fileURL: CFURL!, _ errorRef: UnsafeMutablePointer<Unmanaged<CFError>?>!) -> Unmanaged<CFData>!
```

## Parameters

- `allocator`: The allocator to use to allocate memory for the new CFURL object. Pass NULL or doc://com.apple.corefoundation/documentation/CoreFoundation/kCFAllocatorDefault to use the current default allocator.
- `fileURL`: The file URL.
- `errorRef`: The error that occurred in the case that the bookmark data cannot be created.

## Return Value

Return Value The bookmark data for the file, or NULL if an error occurs.

## See Also

### Working with Bookmark Data

- [CFURLCreateBookmarkData(_:_:_:_:_:_:)](corefoundation/cfurlcreatebookmarkdata(_:_:_:_:_:_:).md)
- [CFURLCreateBookmarkDataFromAliasRecord(_:_:)](corefoundation/cfurlcreatebookmarkdatafromaliasrecord(_:_:).md)
- [CFURLWriteBookmarkDataToFile(_:_:_:_:)](corefoundation/cfurlwritebookmarkdatatofile(_:_:_:_:).md)
- [CFURLStartAccessingSecurityScopedResource(_:)](corefoundation/cfurlstartaccessingsecurityscopedresource(_:).md)
- [CFURLStopAccessingSecurityScopedResource(_:)](corefoundation/cfurlstopaccessingsecurityscopedresource(_:).md)
