Choose your storage product

Polycloud

Object Storage

10 GB FREE

Device Backup

WD My Cloud Home

 

Choose your storage product

Polycloud

Object Storage

10 GB FREE

Device Backup

WD My Cloud Home

 

AWS SDK for JavaScript

Create a `package.json` file with the following contents:

{
  "dependencies": {},
  "name": "nodejs-sample",
  "description": "A simple Node.js application.",
  "version": "1.0.1",
  "main": "list.js",
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  }
}

Install the SDK and Dependencies

npm install aws-sdk

Create a file named `list.js` with the following contents (substituting `mybucket` with your information):

var AWS = require('aws-sdk');

var listPromise = new AWS.S3({
  apiVersion: '2006-03-01',
  endpoint: 'https://polycloud.crowdapis.com',
}).listObjectsV2({Bucket: "mybucket"}).promise();
listPromise.then(
  function(data) {
    data.Contents.forEach(function (obj, index) {
      console.log(obj.Key);
    });
}).catch(
  function(err) {
    console.error(err, err.stack);
});

Run the example:

$ AWS_ACCESS_KEY_ID=<your access key> AWS_SECRET_ACCESS_KEY=<your secret> node list.js