Instance Methodvapor 4.114.1Vapor

collectFile(at:)

Reads the contents of a file at the supplied path.

FileIO.swift:361
func collectFile(at path: String) async throws -> ByteBuffer

Parameters

path

Path to file on the disk.

Returns

ByteBuffer containing the file data.

let data = try await req.fileio.collectFile(file: "/path/to/file.txt")
print(data) // file data