Instance Methodvapor 4.114.1Vapor

writeFile(_:at:)

Write the contents of buffer to a file at the supplied path.

FileIO.swift:315

This declaration is deprecated: Migrate to the async API for this

func writeFile(_ buffer: ByteBuffer, at path: String) -> EventLoopFuture<Void>

Parameters

path

Path to file on the disk.

buffer

The ByteBuffer to write.

Returns

Future that will complete when the file write is finished.

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