Data

public extension Data
  • Creates a data with the content of the file at the given path.

    Declaration

    Swift

    @inlinable
    init(contentsOf path: Path) throws

    Parameters

    path

    The location of file .

  • Writes this data to file on path.

    Declaration

    Swift

    @discardableResult
    func write(to path: Path, append: Bool = false, atomically useAuxiliaryFile: Bool = false) throws -> Path

    Parameters

    path

    The location to which to write this data.

    append

    Appends the data to the end of file.

    useAuxiliaryFile

    If true, the string is written to a backup location, and then the backup location is renamed to the name specified by path; otherwise, the data is written directly to path.

    Return Value

    The path to allow chaining.