readToEnd(fromAbsoluteOffset:maximumSizeAllowed:)

    Returns the contents of a file by loading it into memory.

    FileHandleProtocol.swift:335
    iOS
    13.0+
    macOS
    10.15+
    tvOS
    13.0+
    watchOS
    6.0+
    func readToEnd(fromAbsoluteOffset offset: Int64 = 0, maximumSizeAllowed: ByteCount) async throws -> ByteBuffer

    Parameters

    offset

    The absolute offset into the file to read from. Defaults to zero.

    maximumSizeAllowed

    The maximum size of file to read, as a ByteCount.

    Returns

    The bytes read from the file.

    Throws

    FileSystemError with code resourceExhausted if there are more bytes to read than maximumBytesAllowed. unsupported if file is unseekable and offset is not 0.

    See also