Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/raucao/remotestorage-module-shares

A remoteStorage data module for sharing files
https://github.com/raucao/remotestorage-module-shares

remotestorage remotestorage-module

Last synced: 2 months ago
JSON representation

A remoteStorage data module for sharing files

Awesome Lists containing this project

README

        

[![npm](https://img.shields.io/npm/v/remotestorage-module-shares.svg)](https://www.npmjs.com/package/remotestorage-module-shares)

## 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](#module_shares)
* [storeFile(mimeType, name, data)](#exp_module_shares--storeFile) ⇒ Promise
* [remove(name)](#exp_module_shares--remove) ⇒ Promise
* [list()](#exp_module_shares--list) ⇒ Promise
* [getFileURL(name)](#exp_module_shares--getFileURL) ⇒ 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**
```js
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 |