---
title: "init(bytesWritten:itemAttributes:freeSpace:)"
framework: fskit
role: symbol
role_heading: Initializer
path: "fskit/fswritefileresult/init(byteswritten:itemattributes:freespace:)"
---

# init(bytesWritten:itemAttributes:freeSpace:)

Creates a result for a file-writing operation.

## Declaration

```swift
init?(bytesWritten actuallyWritten: Int, itemAttributes attributes: FSItem.Attributes, freeSpace: FSFreeSpace?)
```

## Parameters

- `actuallyWritten`: The number of bytes actually written to the file. This should match the requested write length unless an error occurred.
- `attributes`: The updated doc://FSKit/documentation/FSKit/FSItem/Attributes of the file after the write operation. Examples of attributes you might need to update are the updated file size and modification time.
- `freeSpace`: An doc://FSKit/documentation/FSKit/FSFreeSpace instance populated with the volume’s updated free space. Passing a nil free space causes FSKit to calculate the free space when the operation is done, based on the volume’s doc://FSKit/documentation/FSKit/FSVolume/Handler/volumeStatistics property. This behavior may lead to degraded performance.

## Return Value

Return Value A populated result instance, or nil if validation fails.

## See Also

### Creating a write-file result

- [FSItem.Attributes](fskit/fsitem/attributes.md)
- [FSFreeSpace](fskit/fsfreespace.md)
