---
title: fileHandleForWriting
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/pipe/filehandleforwriting
---

# fileHandleForWriting

The receiver’s write file handle.

## Declaration

```swift
var fileHandleForWriting: FileHandle { get }
```

## Discussion

Discussion This object is automatically deallocated when the receiver is deallocated. You use the returned file handle to write to the pipe using NSFileHandle’s write(_:) method. When you are finished writing data to this object, send it a closeFile() message to delete the descriptor. Deleting the descriptor causes the reading process to receive an end-of-data signal (an empty NSData object).

## See Also

### Getting the File Handles for a Pipe

- [fileHandleForReading](foundation/pipe/filehandleforreading.md)
