foodordertw-pcloud-sdk-js
v1.0.1
Published
pCloud's Javascript SDK customized by foodordertw
Downloads
11
Maintainers
Readme
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 with some utility on top.
- Universal/Isomorphic.
- Promise based API.
- Simplified OAuth process. Get started in minutes.
Usage
import pcloudSdk from 'foodordertw-pcloud-sdk-js';
// Create `client` using an oAuth token:
const client = pcloudSdk.createClient('access_token');
Upload file:
{
//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>