Docs/API Reference/Storage

Storage API: provider contract

The service selects an explicitly requested provider or its default provider. If the ID is absent or not registered, it attempts the local provider. If the fallback is not…

1 min read

Types#

  • StorageData: name, url, type, size, service, serviceId.
  • StorageError: { error: string }.
  • StorageResult: StorageData | StorageError.
  • IStorageProvider: id, name, upload(file, options?), optional delete(serviceId).
  • IStorageService: registration/default-provider methods plus upload/delete/list methods.

Service selection#

The service selects an explicitly requested provider or its default provider. If the ID is absent or not registered, it attempts the local provider. If the fallback is not registered, upload returns an error object and deletion returns false.

Local driver#

LocalFileProvider uses Node filesystem APIs and the FILE_STORAGE_FOLDER setting. It generates a sanitized unique filename, rejects no-extension/dangerous-extension files, and checks paths before deleting. The caller still owns size/content validation, authorization, visibility, and persistence guarantees.

veap
Preparing0%