remotestorage-module-shares
v2.1.4
Published
remoteStorage.js module for sharing images and other files
Downloads
9
Readme
shares
A remoteStorage data module for sharing of files.
All shares are stored with a timestamp prefix. For images, thumbnails are created and stored in a subdirectory.
- shares
- storeFile(mimeType, name, data) ⇒ Promise ⏏
- remove(name) ⇒ Promise ⏏
- list() ⇒ Promise ⏏
- getFileURL(name) ⇒ string ⏏
storeFile(mimeType, name, data) ⇒ Promise ⏏
Stores a shared file
Kind: Exported function
Returns: Promise - A promise, which will be fulfilled with the absolute
URL of the newly uploaded file (see )
Access: public
| Param | Type | Description | | --- | --- | --- | | mimeType | string | Content type of the file | | name | string | Filename | | data | ArrayBuffer | File contents |
Example
remoteStorage.shares.storeFile(mimeType, filename, content)
.then((url) => { console.log(`successfully stored file at ${url}`)
remove(name) ⇒ Promise ⏏
Remove a file
Kind: Exported function
Access: public
| Param | Type | Description | | --- | --- | --- | | name | string | The filename |
list() ⇒ Promise ⏏
List all shared files
Kind: Exported function
Returns: Promise - Resolves with an array containing the filenames
Access: public
getFileURL(name) ⇒ string ⏏
Get the absolute URL of a file.
Kind: Exported function
Returns: string - The absolute URL of the file
Access: public
| Param | Type | Description | | --- | --- | --- | | name | string | the filename |