2.0.0 • Published 4 years ago

pcloud-sdk-js v2.0.0

Weekly downloads
28
License
ISC
Repository
github
Last release
4 years ago

pCloud JavaScript SDK

JavaScript library that lets you use pCloud functionality in your apps. Includes the full range of the pCloud's API with some utility on top.

  • Universal/Isomorphic.
  • Promise based API.
  • Simplified OAuth process. Get started in minutes.

Usage

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:

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

2.0.0

4 years ago

1.4.4

4 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.2

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.0

7 years ago