Stone.js API
    Preparing search index...

    Multi-disk storage registry.

    Application code resolves a disk by name (storage.disk('s3')) and talks to it through the agnostic FileSystem contract, so the concrete backend is a registration/configuration detail. A local disk rooted at the current working directory is registered by default; an S3FileSystem (or any other driver) is added with registerFactory without touching consumers.

    const storage = StorageManager.create()
    storage.registerFactory('s3', () => S3FileSystem.create({ bucket, region }))
    await storage.disk('s3').put('avatars/1.png', bytes)
    Index
    • Create a StorageManager.

      Parameters

      • defaultDisk: string = 'local'

        The name of the default disk.

      Returns StorageManager

    • Resolve a disk by name (defaults to the default disk).

      Parameters

      • Optionalname: string

        The disk name.

      Returns FileSystem

      The resolved FileSystem driver.

      FilesystemError if no disk/factory is registered under the name.

    • Whether a disk (instance or factory) is registered under the name.

      Parameters

      • name: string

        The disk name.

      Returns boolean

      True if the disk is registered.

    • Register a ready-made disk driver instance.

      Parameters

      • name: string

        The disk name.

      • driver: FileSystem

        The driver instance.

      Returns this

      This manager for chaining.

    • Register a lazy factory for a disk (the driver is built on first access).

      Parameters

      Returns this

      This manager for chaining.

    • Set the default disk name.

      Parameters

      • name: string

        The disk name.

      Returns this

      This manager for chaining.

    • Create a StorageManager.

      Parameters

      • defaultDisk: string = 'local'

        The name of the default disk.

      Returns StorageManager

      A new StorageManager with a local disk registered.