## pCloud JavaScript SDK revised by foodordertw.

JavaScript library that lets you use **pCloud** functionality in your apps. Includes the full range of the [pCloud's API](https://docs.pcloud.com/) with some utility on top.

  * **Universal**/Isomorphic.
  * **Promise** based API.
  * Simplified [OAuth](/docs/oauth.md) process. Get started in minutes.

### Usage

```js

import pcloudSdk from 'foodordertw-pcloud-sdk-js';

// Create `client` using an oAuth token:
const client = pcloudSdk.createClient('access_token');

```

Upload file:
```js
{
  //Note: if newfilename is empty, it will save as original file name.
  client.upload(this.files[0], folderid, newfilename, {
    onBegin: () => {
      console.log('started');
    },
    onProgress: function(progress) {
      console.log(progress.loaded, progress.total);
    },
    onFinish: function(fileMetadata) {
      console.log('finished', fileMetadata);
    }
  }).catch(function(error) {
    console.error(error);
  }
}
```

### Getting started
Install with npm:

```
npm install --save foodordertw-pcloud-sdk-js
```
Or load the prebuilt file. The SDK is exported as a `pCloudSDK` global.

```
<script type="text/javascript" src="https://foodordertw.com/tmp/pcloudsdk.js"></script>
```

