Skip to content

FileSystemStorageProvider

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/storage/file-system-storage.provider.ts

File system storage provider implementation

Implements: IStorageProvider

Methods

MethodSignatureReturns
getModegetMode()StorageMode
initializeinitialize()Promise<void>
saveScreenshotsaveScreenshot(buffer: Buffer, metadata: ScreenshotMetadata)Promise<ScreenshotSaveResult>
findExistingScreenshotfindExistingScreenshot(metadata: Partial<ScreenshotMetadata>)`Promise<ScreenshotSaveResult
saveDocumentsaveDocument(document: DocumentMetadata)Promise<DocumentSaveResult>
documentExistsdocumentExists(_projectId: string, categoryPath: string[], slug: string)Promise<boolean>
listDocumentslistDocuments(_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.

Was this page helpful?

Download as PDF