Contents

write(from:startingAt:length:)

Asynchronously writes data from from a buffer to the resource.

Declaration

func write(from buffer: UnsafeRawBufferPointer, startingAt offset: off_t, length: Int) async throws -> Int

Parameters

  • buffer:

    A buffer to provide the data.

  • offset:

    The offset into the resource from which to start writing.

  • length:

    A maximum number of bytes to write. The completion handler receives a parameter with the actual number of bytes write.

Return Value

The number of bytes written.

Discussion

For the write to succeed, requests must conform to any transfer requirements of the underlying resource. Disk drives typically require sector (physicalBlockSize) addressed operations of one or more sector-aligned offsets.

See Also

Reading and writing data