IDBFileStorage
Provides a Promise-based API to store files into an IndexedDB.
Instances of this class are created using the exported getFileStorage function.
Method Summary
Public Methods | ||
public |
Remove all the file objects stored in the IDBFileStorage. |
|
public |
async count(options: IDBFileStorage.ListFilteringOptions): Promise<number> Count the number of files stored in the IDBFileStorage. |
|
public |
async createMutableFile(fileName: string, fileType: string): IDBPromisedMutableFile Create a new IDBPromisedMutableFile instance (where the IDBMutableFile is supported) |
|
public |
Retrieve a file stored in the IDBFileStorage by key. |
|
public |
async list(options: IDBFileStorage.ListFilteringOptions): Promise<string[]> List the names of the files stored in the IDBFileStorage. |
|
public |
async put(fileName: string, file: Blob | File | IDBPromisedMutableFile | IDBMutableFile): Promise Put a file object into the IDBFileStorage, it overwrites an existent file saved with the fileName if any. |
|
public |
Remove a file object from the IDBFileStorage. |
Public Methods
public async count(options: IDBFileStorage.ListFilteringOptions): Promise<number> source
Count the number of files stored in the IDBFileStorage.
(If any filtering options has been specified, only the file names that match all the filters are included in the final count).
Params:
Name | Type | Attribute | Description |
options | IDBFileStorage.ListFilteringOptions | The optional filters to apply while listing the stored file names. |
public async createMutableFile(fileName: string, fileType: string): IDBPromisedMutableFile source
Create a new IDBPromisedMutableFile instance (where the IDBMutableFile is supported)
public async get(fileName: string): Promise<Blob|File|IDBPromisedMutableFile> source
Retrieve a file stored in the IDBFileStorage by key.
Params:
Name | Type | Attribute | Description |
fileName | string | The key to use to retrieve the file from the IDBFileStorage. |
Return:
Promise<Blob|File|IDBPromisedMutableFile> | A promise resolved once the file stored in the IDBFileStorage has been retrieved. |
public async list(options: IDBFileStorage.ListFilteringOptions): Promise<string[]> source
List the names of the files stored in the IDBFileStorage.
(If any filtering options has been specified, only the file names that match all the filters are included in the result).
Params:
Name | Type | Attribute | Description |
options | IDBFileStorage.ListFilteringOptions | The optional filters to apply while listing the stored file names. |
public async put(fileName: string, file: Blob | File | IDBPromisedMutableFile | IDBMutableFile): Promise source
Put a file object into the IDBFileStorage, it overwrites an existent file saved with the fileName if any.
Params:
Name | Type | Attribute | Description |
fileName | string | The key associated to the file in the IDBFileStorage. |
|
file | Blob | File | IDBPromisedMutableFile | IDBMutableFile | The file to be persisted. |