Skip to content

sindresorhus/ExtendedAttributes

ExtendedAttributes

Manage extended attributes in Swift

Install

Add the following to Package.swift:

.package(url: "https://github.com/sindresorhus/ExtendedAttributes", from: "1.1.0")

Or add the package in Xcode.

Usage

import ExtendedAttributes

let fileURL = URL(filePath: "/path/to/file")
let data = try? fileURL.extendedAttributes.get("com.example.attribute")

You can also use it to access system-specific metadata:

import ExtendedAttributes

let fileURL = URL(filePath: "/path/to/file")
let itemCreator = try? fileURL.systemMetadata.get(kMDItemCreator as String)

API

See the documentation.

Related