---
title: Std.File
---

File system operations through an algebraic effect.

## Types

### FileError

```saga
type FileError =
  | NotFound
  | PermissionDenied
  | IsDirectory
  | NotDirectory
  | NoSpace
  | AlreadyExists
  | Other String
  deriving (Debug)
```

Errors that can occur during file operations.

## Effects

### File

```saga
effect File {
  fun read : String -> Result String FileError
  fun write : String -> String -> Result Unit FileError
  fun append : String -> String -> Result Unit FileError
  fun delete : String -> Result Unit FileError
  fun exists : String -> Bool
}
```

Effect for reading, writing, and querying files.

## Handlers

### fs

```saga
handler fs for File
```

Handler that delegates to the real file system.

