# pcloud-sdk-js

> pCloud's Javascript SDK

Latest version **2.0.0** (published 2020-07-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install pcloud-sdk-js
pnpm add pcloud-sdk-js
yarn add pcloud-sdk-js
bun add pcloud-sdk-js
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2020-07-27 |
| First published | 2017-01-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 4.0.0 |
| Dependencies | 9 |
| Unpacked size | 21.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 130 |
| Author | Diyan Chuburov |
| Maintainers | elanoism, sich |
| Keywords | pcloud, javascript, sdk, cloud |

## Links

- npm: https://www.npmjs.com/package/pcloud-sdk-js
- Repository: https://github.com/pCloud/pcloud-sdk-js
- Homepage: https://github.com/pCloud/pcloud-sdk-js#readme
- Issues: https://github.com/pCloud/pcloud-sdk-js/issues
- npm.io page: https://npm.io/package/pcloud-sdk-js

## Dependencies (9)

- [yarn](https://npm.io/package/yarn.md) ^1.12.1
- [form-data](https://npm.io/package/form-data.md) ^3.0.0
- [invariant](https://npm.io/package/invariant.md) ^2.2.4
- [@babel/cli](https://npm.io/package/@babel/cli.md) ^7.7.5
- [superagent](https://npm.io/package/superagent.md) ^5.1.2
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.7.5
- [deep-assign](https://npm.io/package/deep-assign.md) ^3.0.0
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.7.6
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.7.6

## Recent versions

- 2.0.0 (latest) — 2020-07-27
- 1.4.4 — 2020-04-13
- 1.4.3 — 2018-11-05
- 1.4.2 — 2018-10-16
- 1.4.1 — 2018-08-22
- 1.4.0 — 2018-03-15
- 1.3.1 — 2017-08-11
- 1.3.0 — 2017-07-20
- 1.2.2 — 2017-06-23
- 1.1.3 — 2017-02-07
- 1.1.2 — 2017-01-19
- 1.1.1 — 2017-01-19
- 1.1.0 — 2017-01-19
- 1.0.3 — 2017-01-17
- 1.0.2 — 2017-01-17
- … 2 more at https://npm.io/package/pcloud-sdk-js/versions

## README

## pCloud JavaScript SDK

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 'pcloud-sdk-js';

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

// then list root folder's contents:
client.listfolder(0).then((fileMetadata) => {
  console.log(fileMetadata);
});
```

Upload file:
```js
document.getElementById('inputfile').addEventListener('change', function() {
  client.upload(this.files[0], folderid, {
    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 pcloud-sdk-js
```
Or load the prebuilt file. The SDK is exported as a `pCloudSDK` global.

```
<script type="text/javascript" src="https://unpkg.com/pcloud-sdk-js@latest/dist/pcloudsdk.js"></script>
```

### Read more
- For more information you can view [the documentation](/docs), [the examples](/examples) and the [API Reference](/docs/api.md).
- To learn more about the pCloud's API go to https://docs.pcloud.com.
- SDKs for other platforms you can find at our [SDK site](https://pcloud.github.io).

---
_Source: https://npm.io/package/pcloud-sdk-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
