<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[`Workspace`](Workspace) › [`getActiveFile`](Workspace/getActiveFile)
## Workspace.getActiveFile() method
Returns the file for the current view if it's a `FileView`<!-- -->. Otherwise, it will return the most recently active file.
**Signature:**
```typescript
getActiveFile(): TFile | null;
```
**Returns:**
[`TFile`](TFile)` | null`