# FileSystemStorageProvider

**Kind:** Class

**Source:** [`atloria-monorepo/libs/parser-core/src/storage/file-system-storage.provider.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/parser-core/src/storage/file-system-storage.provider.ts#L27)

File system storage provider implementation

**Implements:** `IStorageProvider`

## Methods

| Method | Signature | Returns |
|---|---|---|
| `getMode` | `getMode()` | `StorageMode` |
| `initialize` | `initialize()` | `Promise<void>` |
| `saveScreenshot` | `saveScreenshot(buffer: Buffer, metadata: ScreenshotMetadata)` | `Promise<ScreenshotSaveResult>` |
| `findExistingScreenshot` | `findExistingScreenshot(metadata: Partial<ScreenshotMetadata>)` | `Promise<ScreenshotSaveResult | null>` |
| `saveDocument` | `saveDocument(document: DocumentMetadata)` | `Promise<DocumentSaveResult>` |
| `documentExists` | `documentExists(_projectId: string, categoryPath: string[], slug: string)` | `Promise<boolean>` |
| `listDocuments` | `listDocuments(_projectId: string, categoryPath: string[])` | `Promise<Array<{ id: string; title: string; slug: string; url: string }>>` |

## Where it refuses work

- `FileSystemStorageProvider` stops the work with an early return when `existing`.
- `FileSystemStorageProvider` stops the work with an early return when `query.projectId && stored.projectId !== query.projectId`.
- `FileSystemStorageProvider` stops the work with an early return when `query.url && stored.url !== query.url`.
- `FileSystemStorageProvider` stops the work with an early return when `stored.viewport.width !== query.viewport.width || stored.viewport.height !== query.viewpo…`.
- `FileSystemStorageProvider` stops the work with an early return when `query.stateType && stored.stateType !== query.stateType`.
- `FileSystemStorageProvider` stops the work with an early return when `query.flowStepId && stored.flowStepId !== query.flowStepId`.

## When something fails

- `FileSystemStorageProvider` handles failure in 5 places: it turns it into a return value in 3, and discards it silently in 2. A failure discarded silently leaves no trace for whoever debugs this later.
