LocalStorageAdapter
Experimental Alpha
LocalStorageAdapter defines the interface for local file storage operations. Implementations handle file I/O, directory management, and storage initialization.
This is currently experimental and may change without a major version bump.
Methods
clear()
clear(): Promise<void>;
Alpha
Clears all files in the storage.
Returns
Promise<void>
deleteFile()
deleteFile(filePath): Promise<void>;
Alpha
Deletes the file at the given path.
Parameters
| Parameter | Type | Description |
|---|---|---|
filePath | string | Path where the file is stored |
Returns
Promise<void>
fileExists()
fileExists(filePath): Promise<boolean>;
Alpha
Checks if a file exists at the given path.
Parameters
| Parameter | Type | Description |
|---|---|---|
filePath | string | Path where the file is stored |
Returns
Promise<boolean>
True if the file exists, false otherwise
getLocalUri()
getLocalUri(filename): string;
Alpha
Returns the file path for the provided filename in the storage directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
filename | string | The filename to get the path for |
Returns
string
The full file path
initialize()
initialize(): Promise<void>;
Alpha
Initializes the storage adapter (e.g., creating necessary directories).
Returns
Promise<void>
makeDir()
makeDir(path): Promise<void>;
Alpha
Creates a directory at the specified path.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | The full path to the directory |
Returns
Promise<void>
readFile()
readFile(filePath): Promise<ArrayBuffer>;
Alpha
Retrieves file data as an ArrayBuffer.
Parameters
| Parameter | Type | Description |
|---|---|---|
filePath | string | Path where the file is stored |
Returns
Promise<ArrayBuffer>
ArrayBuffer containing the file data
rmDir()
rmDir(path): Promise<void>;
Alpha
Removes a directory at the specified path.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | The full path to the directory |
Returns
Promise<void>
saveFile()
saveFile(filePath, data): Promise<number>;
Alpha
Saves data to a local file.
Parameters
| Parameter | Type | Description |
|---|---|---|
filePath | string | Path where the file will be stored |
data | AttachmentData | Data to store (ArrayBuffer, Blob, or string) |
Returns
Promise<number>
Number of bytes written