CDNConnect.com client module.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
.npmignore
LICENSE
Makefile
README.md
package.json

README.md

CDNConncet.com Node.js client

Simple client for www.cdconnect.com API.

Install

npm install node-cdnconnect

Usage

Usage is quite simple, so just follow the examples below:

CDNConnectClient = require('node-cdnconnect');

cdnClient = new CDNConnectClient({
   	appName: 'YOUR_CDN_APP_NAME'
    apiKey: 'YOUR_CDN_API_KEY',
});

// create a folder with a sub folder in the root: /testFolder/subFolder
cdnClient.mkdir('/testFolder/subfolder', function(err, data) {});

// upload a file to CDN folder. The PATH_TO_FILE basename will be used as the CDN file name.
cdnClient.writeFile('PATH_TO_FILE', '/testFolder', function(err, data) {});
// ask for stats about a file or folder
cdnClient.stat('/testFolder', function(err, data) {});
// rename a file or a folder
cdnClient.rename('/testFolder/subFolder', 'renamedSubFolder', function(err, data) {});

// delete a file or folder:
var moveToTrash = true; // false to delete permanently, otherwise send to the CND trash folder
cdnClient.unlink(newFile, moveToTrash, function(err, data) {});

For a complete descriptions of the data returned to your callback functions look at the CDNConnect.com documentation.