storage
Module: vibex/storage
BaseStorage - Abstract storage interface for all VibeX storage needs
Storage paths are logical prefixes/keys, not filesystem paths. The adapter implementation determines how paths are interpreted:
- LocalStorageAdapter: converts logical paths to filesystem paths
- SupabaseStorageAdapter: uses logical paths as storage bucket keys/prefixes
Classes
BaseStorage
View sourceMethods:
initialize
View sourceInitialize storage (ensure directories exist)
function initialize(): Promise<void>readJSON
View sourceRead JSON file
function readJSON<T = unknown>(relativePath: string): Promise<T | null>Parameters:
| Name | Type | Description |
|---|---|---|
relativePath | string |
readYaml
View sourceRead YAML file
function readYaml<T = unknown>(relativePath: string): Promise<T | null>Parameters:
| Name | Type | Description |
|---|---|---|
relativePath | string |
writeJSON
View sourceWrite JSON file
function writeJSON(relativePath: string, data: unknown): Promise<void>Parameters:
| Name | Type | Description |
|---|---|---|
relativePath | string | |
data | unknown |
exists
View sourceCheck if file exists
function exists(relativePath: string): Promise<boolean>Parameters:
| Name | Type | Description |
|---|---|---|
relativePath | string |
readTextFile
View sourceRead text file
function readTextFile(relativePath: string): Promise<string>Parameters:
| Name | Type | Description |
|---|---|---|
relativePath | string |
readFile
View sourceRead file as buffer (binary)
function readFile(relativePath: string): Promise<Buffer>Parameters:
| Name | Type | Description |
|---|---|---|
relativePath | string |
writeFile
View sourceWrite file (text or binary)
function writeFile(relativePath: string, data: Buffer | string): Promise<void>Parameters:
| Name | Type | Description |
|---|---|---|
relativePath | string | |
data | Buffer | string |
delete
View sourceDelete file
function delete(relativePath: string): Promise<void>Parameters:
| Name | Type | Description |
|---|---|---|
relativePath | string |
list
View sourceList files in directory
function list(relativePath: string = ""): Promise<string[]>Parameters:
| Name | Type | Description |
|---|---|---|
relativePath | string | (default: "") |
mkdir
View sourceCreate directory
function mkdir(relativePath: string): Promise<void>Parameters:
| Name | Type | Description |
|---|---|---|
relativePath | string |
saveArtifact
View sourceSave an artifact (file + metadata)
function saveArtifact(spaceId: string, artifact: ArtifactInfo, buffer: Buffer): Promise<ArtifactInfo>Parameters:
| Name | Type | Description |
|---|---|---|
spaceId | string | |
artifact | ArtifactInfo | |
buffer | Buffer |
getArtifact
View sourceGet an artifact (file + metadata)
function getArtifact(spaceId: string, artifactId: string): Promise<{ info: ArtifactInfo; buffer: Buffer } | null>Parameters:
| Name | Type | Description |
|---|---|---|
spaceId | string | |
artifactId | string |
getArtifactInfo
View sourceGet artifact metadata only
function getArtifactInfo(spaceId: string, artifactId: string): Promise<ArtifactInfo | null>Parameters:
| Name | Type | Description |
|---|---|---|
spaceId | string | |
artifactId | string |
listArtifacts
View sourceList all artifacts for a space
function listArtifacts(spaceId: string): Promise<ArtifactInfo[]>Parameters:
| Name | Type | Description |
|---|---|---|
spaceId | string |
deleteArtifact
View sourceDelete an artifact
function deleteArtifact(spaceId: string, artifactId: string): Promise<void>Parameters:
| Name | Type | Description |
|---|---|---|
spaceId | string | |
artifactId | string |