[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7099":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":15,"starSnapshotCount":15,"syncStatus":32,"lastSyncTime":33,"discoverSource":34},7099,"Files","JohnSundell\u002FFiles","JohnSundell","A nicer way to handle files & folders in Swift",null,"Swift",2637,197,45,18,0,1,3,28.89,"MIT License",false,"master",[23,24,25,26,27,28],"files","folders","script","swift","swift-script","xcode","2026-06-12 02:01:34","\u003Cp align=\"center\">\n    \u003Cimg src=\"logo.png\" width=\"300\" max-width=\"50%\" alt=“Files” \u002F>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n    \u003Ca href=\"https:\u002F\u002Fdashboard.buddybuild.com\u002Fapps\u002F5932f7d9b0c2b000015d6b79\u002Fbuild\u002Flatest?branch=master\">\n        \u003Cimg src=\"https:\u002F\u002Fdashboard.buddybuild.com\u002Fapi\u002FstatusImage?appID=5932f7d9b0c2b000015d6b79&branch=master&build=latest\" alt=\"BuddyBuild\" \u002F>\n    \u003C\u002Fa>\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FSwift-5.0-orange.svg\" \u002F>\n    \u003Ca href=\"https:\u002F\u002Fcocoapods.org\u002Fpods\u002FFiles\">\n        \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fcocoapods\u002Fv\u002FFiles.svg\" alt=\"CocoaPods\" \u002F>\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FCarthage\u002FCarthage\">\n        \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcarthage-compatible-4BC51D.svg?style=flat\" alt=\"Carthage\" \u002F>\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fswift.org\u002Fpackage-manager\">\n        \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fspm-compatible-brightgreen.svg?style=flat\" alt=\"Swift Package Manager\" \u002F>\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Ftwitter.com\u002Fjohnsundell\">\n        \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcontact-@johnsundell-blue.svg?style=flat\" alt=\"Twitter: @johnsundell\" \u002F>\n    \u003C\u002Fa>\n\u003C\u002Fp>\n\nWelcome to **Files**, a compact library that provides a nicer way to handle *files* and *folders*  in Swift. It’s primarily aimed at Swift scripting and tooling, but can also be embedded in applications that need to access the file system. It's essentially a thin wrapper around the `FileManager` APIs that `Foundation` provides.\n\n## Features\n\n- [X] Modern, object-oriented API for accessing, reading and writing files & folders.\n- [X] Unified, simple `do, try, catch` error handling.\n- [X] Easily construct recursive and flat sequences of files and folders.\n\n## Examples\n\nIterate over the files contained in a folder:\n\n```swift\nfor file in try Folder(path: \"MyFolder\").files {\n    print(file.name)\n}\n```\n\nRename all files contained in a folder:\n\n```swift\ntry Folder(path: \"MyFolder\").files.enumerated().forEach { (index, file) in\n    try file.rename(to: file.nameWithoutExtension + \"\\(index)\")\n}\n```\n\nRecursively iterate over all folders in a tree:\n\n```swift\nFolder.home.subfolders.recursive.forEach { folder in\n    print(\"Name : \\(folder.name), parent: \\(folder.parent)\")\n}\n```\n\nCreate, write and delete files and folders:\n\n```swift\nlet folder = try Folder(path: \"\u002Fusers\u002Fjohn\u002Ffolder\")\nlet file = try folder.createFile(named: \"file.json\")\ntry file.write(\"{\\\"hello\\\": \\\"world\\\"}\")\ntry file.delete()\ntry folder.delete()\n```\n\nMove all files in a folder to another:\n\n```swift\nlet originFolder = try Folder(path: \"\u002Fusers\u002Fjohn\u002FfolderA\")\nlet targetFolder = try Folder(path: \"\u002Fusers\u002Fjohn\u002FfolderB\")\ntry originFolder.files.move(to: targetFolder)\n```\n\nEasy access to system folders:\n\n```swift\nFolder.current\nFolder.root\nFolder.library\nFolder.temporary\nFolder.home\nFolder.documents\n```\n\n## Installation\n\nFiles can be easily used in either a Swift script, a command line tool, or in an app for iOS, macOS, tvOS or Linux.\n\n### Using the Swift Package Manager (preferred)\n\nTo install Files for use in a Swift Package Manager-powered tool, script or server-side application, add Files as a dependency to your `Package.swift` file. For more information, please see the [Swift Package Manager documentation](https:\u002F\u002Fgithub.com\u002Fapple\u002Fswift-package-manager\u002Ftree\u002Fmaster\u002FDocumentation).\n\n```swift\n.package(url: \"https:\u002F\u002Fgithub.com\u002FJohnSundell\u002FFiles\", from: \"4.0.0\")\n```\n\n### Using CocoaPods or Carthage\n\nPlease refer to [CocoaPods’](https:\u002F\u002Fcocoapods.org) or [Carthage’s](https:\u002F\u002Fgithub.com\u002FCarthage\u002FCarthage) own documentation for instructions on how to add dependencies using those tools.\n\n### As a file\n\nSince all of Files is implemented within a single file, you can easily use it in any project by simply dragging the file `Files.swift` into your Xcode project.\n\n## Backstory\n\nSo, why was this made? As I've migrated most of my build tools and other scripts from languages like Bash, Ruby and Python to Swift, I've found myself lacking an easy way to deal with the file system. Sure, `FileManager` has a quite nice API, but it can be quite cumbersome to use because of its string-based nature, which makes simple scripts that move or rename files quickly become quite complex.\n\nSo, I made **Files**, to enable me to quickly handle files and folders, in an expressive way. And, since I love open source, I thought - why not package it up and share it with the community? :)\n\n## Questions or feedback?\n\nFeel free to [open an issue](https:\u002F\u002Fgithub.com\u002FJohnSundell\u002FFiles\u002Fissues\u002Fnew), or find me [@johnsundell on Twitter](https:\u002F\u002Ftwitter.com\u002Fjohnsundell).\n","Files 是一个用于在 Swift 中更优雅地处理文件和文件夹的库。它提供了一个现代化、面向对象的API来访问、读取和写入文件及文件夹，并统一了错误处理机制，支持通过简单的`do, try, catch`语句进行异常捕获。此外，该库还简化了递归或扁平序列中文件与文件夹的操作过程。Files 适用于需要与文件系统交互的各种场景，特别是Swift脚本编写、工具开发以及希望以更简洁方式管理文件的应用程序内嵌使用。其兼容性广泛，既可以通过Swift Package Manager轻松集成到iOS、macOS等平台的应用中，也支持作为命令行工具的一部分被调用。",2,"2026-06-11 03:10:32","top_language"]