<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSWriteFileResult/init(bytesWritten:itemAttributes:freeSpace:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "c:objc(cs)FSWriteFileResult(im)initWithBytesWritten:itemAttributes:freeSpace:"
  },
  "title" : "init(bytesWritten:itemAttributes:freeSpace:)"
}
-->

# init(bytesWritten:itemAttributes:freeSpace:)

Creates a result for a file-writing operation.

```
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 [`FSItem.Attributes`](/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 [`FSFreeSpace`](/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 [`volumeStatistics`](/documentation/FSKit/FSVolume/Handler/volumeStatistics) property. This behavior may lead to degraded performance.

## Return Value

A populated result instance, or `nil` if validation fails.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)