IndexDBFileSystemStorageAdapter
IndexDBFileSystemStorageAdapter implements LocalStorageAdapter using IndexedDB. Suitable for web browsers and web-based environments.
Implements
Constructors
new IndexDBFileSystemStorageAdapter()
new IndexDBFileSystemStorageAdapter(databaseName): IndexDBFileSystemStorageAdapter
Parameters
| Parameter | Type | Default value |
|---|---|---|
databaseName | string | 'PowerSyncFiles' |
Returns
IndexDBFileSystemStorageAdapter
Methods
clear()
clear(): Promise<void>
Returns
Promise<void>
Implementation of
deleteFile()
deleteFile(uri, options?): Promise<void>
Parameters
| Parameter | Type |
|---|---|
uri | string |
options? | { filename: string; } |
options.filename? | string |
Returns
Promise<void>
Implementation of
LocalStorageAdapter.deleteFile
fileExists()
fileExists(fileUri): Promise<boolean>
Parameters
| Parameter | Type |
|---|---|
fileUri | string |
Returns
Promise<boolean>
True if the file exists, false otherwise
Implementation of
LocalStorageAdapter.fileExists
getLocalUri()
getLocalUri(filename): string
Parameters
| Parameter | Type | Description |
|---|---|---|
filename | string | The filename to get the path for |
Returns
string
The full file path
Implementation of
LocalStorageAdapter.getLocalUri
initialize()
initialize(): Promise<void>
Returns
Promise<void>
Implementation of
LocalStorageAdapter.initialize
makeDir()
makeDir(path): Promise<void>
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | The full path to the directory |
Returns
Promise<void>
Implementation of
readFile()
readFile(fileUri, options?): Promise<ArrayBuffer>
Parameters
| Parameter | Type |
|---|---|
fileUri | string |
options? | { encoding: EncodingType; mediaType: string; } |
options.encoding? | EncodingType |
options.mediaType? | string |
Returns
Promise<ArrayBuffer>
ArrayBuffer containing the file data
Implementation of
rmDir()
rmDir(path): Promise<void>
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | The full path to the directory |
Returns
Promise<void>
Implementation of
saveFile()
saveFile(filePath, data): Promise<number>
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