PathKit icon indicating copy to clipboard operation
PathKit copied to clipboard

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

Open iT-Boyer opened this issue 1 year ago • 0 comments

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)
}

iT-Boyer avatar Apr 17 '23 02:04 iT-Boyer