Instance Methodvapor 4.114.1Vapor

collectFile(at:)

Reads the contents of a file at the supplied path.

FileIO.swift:73

This declaration is deprecated: Migrate to async API

func collectFile(at path: String) -> EventLoopFuture<ByteBuffer>

Parameters

path

Path to file on the disk.

Returns

Future containing the file data as a ByteBuffer.

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