Type Alias IFileStorageResolver<TAdapters>

IFileStorageResolver: { use(adapterName?: TAdapters): IFileStorage }

File storage resolver contract for dynamically selecting and switching between storage adapters. Simplifies adapter management by providing a single interface to access registered storage implementations.

Typical usage:

  • Development: Use memory storage
  • Testing: Use mock storage
  • Production: Use S3 or cloud storage All without changing application code (just switch the configured adapter).

Type Parameters

  • TAdapters extends string = string

    Union type of registered adapter names (e.g., "memory" | "s3" | "fs")

    IMPORT_PATH: "@daiso-tech/core/file-storage/contracts"

Type declaration

  • use:function
    • Retrieves a file storage adapter by name. If no adapter name is provided, uses the default registered adapter.

      Parameters

      • OptionaladapterName: TAdapters

        The name of the adapter to retrieve (optional). If not provided, uses the default adapter.

      Returns IFileStorage

      The requested file storage adapter

      If the specified adapter name is not registered

      If no adapter name is provided and no default adapter is defined