Skip to content

Instance Method

writeFile(_:at:)

Write the contents of buffer to a file at the supplied path.
func writeFile(_ buffer: ByteBuffer, at path: String) async throws

Parameters

buffer

The ByteBuffer to write.

path

Path to file on the disk.

Discussion

let data = ByteBuffer(string: "ByteBuffer")
try await req.fileio.writeFile(data, at: "/path/to/file.txt")

Warning

This method will overwrite the file if it already exists.