Skip to Content
SDKvibexStorage

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 source

Methods:

initialize

View source

Initialize storage (ensure directories exist)

function initialize(): Promise<void>

readJSON

View source

Read JSON file

function readJSON<T = unknown>(relativePath: string): Promise<T | null>

Parameters:

NameTypeDescription
relativePathstring

readYaml

View source

Read YAML file

function readYaml<T = unknown>(relativePath: string): Promise<T | null>

Parameters:

NameTypeDescription
relativePathstring

writeJSON

View source

Write JSON file

function writeJSON(relativePath: string, data: unknown): Promise<void>

Parameters:

NameTypeDescription
relativePathstring
dataunknown

exists

View source

Check if file exists

function exists(relativePath: string): Promise<boolean>

Parameters:

NameTypeDescription
relativePathstring

readTextFile

View source

Read text file

function readTextFile(relativePath: string): Promise<string>

Parameters:

NameTypeDescription
relativePathstring

readFile

View source

Read file as buffer (binary)

function readFile(relativePath: string): Promise<Buffer>

Parameters:

NameTypeDescription
relativePathstring

writeFile

View source

Write file (text or binary)

function writeFile(relativePath: string, data: Buffer | string): Promise<void>

Parameters:

NameTypeDescription
relativePathstring
dataBuffer | string

delete

View source

Delete file

function delete(relativePath: string): Promise<void>

Parameters:

NameTypeDescription
relativePathstring

list

View source

List files in directory

function list(relativePath: string = ""): Promise<string[]>

Parameters:

NameTypeDescription
relativePathstring(default: "")

mkdir

View source

Create directory

function mkdir(relativePath: string): Promise<void>

Parameters:

NameTypeDescription
relativePathstring

saveArtifact

View source

Save an artifact (file + metadata)

function saveArtifact(spaceId: string, artifact: ArtifactInfo, buffer: Buffer): Promise<ArtifactInfo>

Parameters:

NameTypeDescription
spaceIdstring
artifactArtifactInfo
bufferBuffer

getArtifact

View source

Get an artifact (file + metadata)

function getArtifact(spaceId: string, artifactId: string): Promise<{ info: ArtifactInfo; buffer: Buffer } | null>

Parameters:

NameTypeDescription
spaceIdstring
artifactIdstring

getArtifactInfo

View source

Get artifact metadata only

function getArtifactInfo(spaceId: string, artifactId: string): Promise<ArtifactInfo | null>

Parameters:

NameTypeDescription
spaceIdstring
artifactIdstring

listArtifacts

View source

List all artifacts for a space

function listArtifacts(spaceId: string): Promise<ArtifactInfo[]>

Parameters:

NameTypeDescription
spaceIdstring

deleteArtifact

View source

Delete an artifact

function deleteArtifact(spaceId: string, artifactId: string): Promise<void>

Parameters:

NameTypeDescription
spaceIdstring
artifactIdstring