withFileRegion(path:_:)

Open file at path and query its size on a private thread pool, run an operation given the resulting file region and then close the file handle.

NonBlockingFileIO.swift:1075

This declaration is deprecated: Avoid using NonBlockingFileIO. The API is difficult to hold correctly, use NIOFileSystem as a replacement API.

func withFileRegion<Result>(path: String, _ body: (_ fileRegion: FileRegion) async throws -> Result) async throws -> Result

Parameters

path

The path of the file to be opened for reading.

body

operation to run with file handle and region

Returns

return value of operation

The will return the result of the operation.