Skip to content

How to add text to the last line of a text file #87

@iT-Boyer

Description

@iT-Boyer

Consulting chatgpt gives the following tips, but the append method is not found in pathkit:

import PathKit

let path = Path("/path/to/file.txt")
let text = "Hello, PathKit!"

do {
    try path.append(text) //add text to the last line of a text file
} catch let error {
    print(error)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions