GithubHelp home page GithubHelp logo

nodecloudpt's Introduction

NodeCloudPT -- NodeJS SDK for the CloudPT service

NodeCloudPT

NodeCloudPT is a NodeJS SDK for the CoudPT service that covers all the API methods and parameters. You can see all the API documentation here.

Also has an experimental function that imports directly a file from a URL.

Basic Examples

Create an instance

var cloudpt = new NodeCloudPT({
	oauth : {
		consumer_key : "your consumer key",
		consumer_secret : "your consumer secret",
		token : "your access token",
		token_secret : "your access token secret"
	}
});

Account Info

cloudpt.accountInfo(function(data) {
	console.log(data);
});

Metadata

cloudpt.metadata({path:"/test", list:true}, function(data) {
	console.log(data);
});

List

cloudptlist({path:"/metal",max_rows:1}, function(data) {
	console.log(data);
});

Create Folder

cloudpt.createFolder({path: "/mikeal"}, function(data) {
	console.log(data);
});

Delta

cloudpt.delta(function(data) {
	console.log(data);
});

Copy

cloudpt.copy({from_path:"heavy/world.js", to_path:"soft/world-copy.js"}, function(data) {
	console.log(data);
});

See more examples on tests folder

Uploading and downloading files

Upload

You have to describe the path on the server to place the file on your filesystem.

cloudpt.upload({path:"music/sigur.mp3", file:"sigur.mp3"}, function(data) {
	console.log(data);
});

Download

You have to describe the path on the server where to get the content. You can indicate a file on your filesystem to save the result our get it on the callback function.

// get content on data variable
cloudpt.download({path:"/style/gangnam.png"}, function(data) {
	console.log(data);
});
// save content to a file
cloudpt.download({path:"/style/gangnam.png", file:"gangnam-file.png"}, function(data) {
	console.log(data);
});

Import directly from URL

You can import a file directly from a URL by describing the urlwhere to find the file and the path where to store it.

// get content on data variable
cloudpt.importFromURL({path:"/specialone/main.pdf",url:"http://some.url.com/somefile.pdf"}, function(data) {
	console.log(data);
});

TODO

  • Functions to get the oAuth tokens
  • Import directly from other storage services

nodecloudpt's People

Contributors

landeiro avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.