func copy(AbsolutePath, to: AbsolutePath) async throws
Given a path, it copies the file or directory to another path.
func createSymbolicLink(from: AbsolutePath, to: RelativePath) async throws
Creates a relative symlink.
func createSymbolicLink(from: AbsolutePath, to: AbsolutePath) async throws
Creates a symlink.
func currentWorkingDirectory() async throws -> AbsolutePath
Returns the path of the current working directory.
func exists(AbsolutePath) async throws -> Bool
It checks for the presence of a file or directory.
func exists(AbsolutePath, isDirectory: Bool) async throws -> Bool
It checks for the presence of files and directories.
func glob(directory: Path.AbsolutePath, include: [String]) throws -> AnyThrowingAsyncSequenceable<Path.AbsolutePath>
Looks up files and directories that match a set of glob patterns.
func locateTraversingUp(from: AbsolutePath, relativePath: RelativePath) async throws -> AbsolutePath?
Given a path, it traverses the hierarcy until it finds a file or directory whose absolute path is formed by concatenating the looked up path and the given relative path. The search stops when the file-system root path, /
, is reached.
func makeDirectory(at: AbsolutePath) async throws
Makes a directory at the given path.
func makeDirectory(at: AbsolutePath, options: [MakeDirectoryOptions]) async throws
Makes a directory at the given path.
func makeTemporaryDirectory(prefix: String) async throws -> AbsolutePath
Creates a temporary directory and returns its path.
func move(from: AbsolutePath, to: AbsolutePath) async throws
Moves a file or directory from one path to another. If the parent directory of the target path doesn’t exist, it creates it by default.
func move(from: AbsolutePath, to: AbsolutePath, options: [MoveOptions]) async throws
Moves a file or directory from one path to another.
func readFile(at: AbsolutePath) async throws -> Data
Reads the file at path and returns it as data.
func readJSONFile<T>(at: AbsolutePath) async throws -> T
Reads a JSON file at a given path, and decodes it into the provided decodable type.
func readJSONFile<T>(at: AbsolutePath, decoder: JSONDecoder) async throws -> T
Reads a JSON file at a given path, and decodes it into the provided decodable type.
func readPlistFile<T>(at: AbsolutePath) async throws -> T
Reads a property list file at a given path, and decodes it into the provided decodable type.
func readPlistFile<T>(at: AbsolutePath, decoder: PropertyListDecoder) async throws -> T
Reads a property list file at a given path, and decodes it into the provided decodable type.
func readTextFile(at: AbsolutePath) async throws -> String
Reads the file at a given path, decodes its content using UTF-8 encoding, and returns the content as a String.
func readTextFile(at: Path.AbsolutePath, encoding: String.Encoding) async throws -> String
Reads the file at a given path, decodes its content using the provided encoding, and returns the content as a String.
func remove(AbsolutePath) async throws
It removes the file or directory at the given path.
func replace(AbsolutePath, with: AbsolutePath) async throws
Given a path, it replaces it with the file or directory at the other path.
func resolveSymbolicLink(AbsolutePath) async throws -> AbsolutePath
Given a symlink, it resolves it returning the path to the file or directory the symlink is pointing to.
func runInTemporaryDirectory<T>(prefix: String, (_ temporaryDirectory: AbsolutePath) async throws -> T) async throws -> T
func touch(AbsolutePath) async throws
Creates a file at the given path
func unzip(AbsolutePath, to: AbsolutePath) async throws
Unzips a zip file.
func writeAsJSON<T>(T, at: AbsolutePath) async throws
Given an Encodable
instance, it encodes it as a JSON, and writes it at the given path.
func writeAsJSON<T>(T, at: AbsolutePath, encoder: JSONEncoder) async throws
Given an Encodable
instance, it encodes it as a JSON, and writes it at the given path.
func writeAsJSON<T>(T, at: AbsolutePath, encoder: JSONEncoder, options: Set<WriteJSONOptions>) async throws
Given an Encodable
instance, it encodes it as a JSON, and writes it at the given path.
func writeAsPlist<T>(T, at: AbsolutePath) async throws
Given an Encodable
instance, it encodes it as a Plist, and writes it at the given path.
func writeAsPlist<T>(T, at: AbsolutePath, encoder: PropertyListEncoder) async throws
Given an Encodable
instance, it encodes it as a Plist, and writes it at the given path.
func writeAsPlist<T>(T, at: AbsolutePath, encoder: PropertyListEncoder, options: Set<WritePlistOptions>) async throws
Given an Encodable
instance, it encodes it as a Plist, and writes it at the given path.
func writeText(String, at: AbsolutePath) async throws
It writes the text at the given path. It encodes the text using UTF-8
func writeText(String, at: AbsolutePath, encoding: String.Encoding) async throws
It writes the text at the given path.
func writeText(String, at: AbsolutePath, encoding: String.Encoding, options: Set<WriteTextOptions>) async throws
It writes the text at the given path.
func zipFileOrDirectoryContent(at: AbsolutePath, to: AbsolutePath) async throws
Zips a file or the content of a given directory.