> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-HK/llms.txt # BlobStoreProvider `BlobStoreProvider` 是套件用來向 [`MastraEditor`](https://mastra.zisheng.pro/zh-HK/reference/editor/mastra-editor) 註冊 blob store 的介面。Blob store 用於保存可按內容定址的 Skill blob,以及 Editor 產生的其他大型成品。 內置的 `storage` Provider 會使用已配置儲存後端的 `blobs` domain。外部 Provider(例如 S3)則透過 `MastraEditorConfig.blobStores` 提供。 ## 使用範例 ```typescript import { MastraEditor } from '@mastra/editor' import { s3BlobStoreProvider } from '@mastra/s3' new MastraEditor({ blobStores: { [s3BlobStoreProvider.id]: s3BlobStoreProvider, }, }) ``` ## 屬性 **id** (`string`): 唯一的 Provider 標識符(例如 "storage"、"s3")。 **name** (`string`): 在 UI 顯示、方便使用者閱讀的名稱。 **description** (`string`): 簡短描述。 **configSchema** (`Record`): 描述 Provider 專屬配置的 JSON Schema。UI 會使用它呈現配置表單。 **createBlobStore** (`(config: TConfig) => BlobStore | Promise`): 從已儲存的配置建立執行階段 BlobStore 實例。Editor 透過 MastraEditor.resolveBlobStore(providerId, config) 解析 blob store 時呼叫。 ## 實作 Provider ```typescript import type { BlobStore, BlobStoreProvider } from '@mastra/core/editor' export const myBlobStoreProvider: BlobStoreProvider<{ bucket: string; region: string }> = { id: 'my-blob-store', name: 'My Blob Store', description: 'Object-store-backed blob storage.', configSchema: { type: 'object', required: ['bucket', 'region'], properties: { bucket: { type: 'string' }, region: { type: 'string' }, }, }, async createBlobStore(config): Promise { return createMyBlobStore({ bucket: config.bucket, region: config.region }) }, } ``` 如果沒有將 `providerId` 傳給 `MastraEditor.resolveBlobStore()`,Editor 會改用儲存後端的 `blobs` domain。 ## 相關內容 - [MastraEditor 類別](https://mastra.zisheng.pro/zh-HK/reference/editor/mastra-editor):Provider registry 及 `resolveBlobStore()` 方法。