---
title: "write(from:)"
framework: applearchive
role: symbol
role_heading: Instance Method
path: "applearchive/archivebytestreamprotocol/write(from:)"
---

# write(from:)

Writes data from the specified buffer, not exceeding the buffer’s allocated size.

## Declaration

```swift
func write(from buffer: UnsafeRawBufferPointer) throws -> Int
```

## Parameters

- `buffer`: The data buffer that the operation uses as a source for the data.

## Return Value

Return Value The number of bytes written by the stream.

## Discussion

Discussion This function increments the internal stream position by the number of bytes written by the stream.

## See Also

### Reading and Writing Data

- [read(into:)](applearchive/archivebytestreamprotocol/read(into:).md)
- [read(into:atOffset:)](applearchive/archivebytestreamprotocol/read(into:atoffset:).md)
- [write(from:atOffset:)](applearchive/archivebytestreamprotocol/write(from:atoffset:).md)
