PathKit
PathKit copied to clipboard
How to add text to the last line of a text file
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)
}