https://github.com/binarybirds/path-kit
Working with files and directories in a nice way using Swift.
https://github.com/binarybirds/path-kit
swift swift-5
Last synced: about 1 year ago
JSON representation
Working with files and directories in a nice way using Swift.
- Host: GitHub
- URL: https://github.com/binarybirds/path-kit
- Owner: BinaryBirds
- License: mit
- Created: 2020-04-20T10:15:50.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2022-02-17T15:17:03.000Z (over 4 years ago)
- Last Synced: 2025-03-13T11:43:42.725Z (over 1 year ago)
- Topics: swift, swift-5
- Language: Swift
- Homepage:
- Size: 7.81 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PathKit (💾)
Working with files and directories in a nice way using Swift.
## Usage
Some examples:
```swift
import PathKit
let caches = Path.systemDirectory(for: .caches)
let home = Path.home
let parent = home.parent
let root = Path.root
let current = Path.current
let test = current.child("test")
print(test.isDirectory)
print(test.children().filter(\.isFile))
do {
let work = try home.add("my-work-dir")
print(work.location)
try test.delete()
try test.create()
let a = current.child("a")
try a.create()
let b = current.child("b")
let c = current.child("c")
let d = current.child("d")
try a.copy(to: b)
try a.link(to: c)
try a.move(to: d, force: true)
}
catch {
print(error.localizedDescription)
}
```
## Install
Just use the Swift Package Manager as usual:
```swift
.package(url: "https://github.com/binarybirds/path-kit", from: "1.0.0"),
```
Don't forget to add "PathKit" to your target as a dependency!
```swift
.product(name: "PathKit", package: "path-kit"),
```
That's it.
## License
[WTFPL](LICENSE) - Do what the fuck you want to.