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.
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"
}
});
cloudpt.accountInfo(function(data) {
console.log(data);
});
cloudpt.metadata({path:"/test", list:true}, function(data) {
console.log(data);
});
cloudpt.list({path:"/metal",max_rows:1}, function(data) {
console.log(data);
});
cloudpt.createFolder({path: "/mikeal"}, function(data) {
console.log(data);
});
cloudpt.delta(function(data) {
console.log(data);
});
cloudpt.copy({from_path:"heavy/world.js", to_path:"soft/world-copy.js"}, function(data) {
console.log(data);
});
See more examples on tests folder
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);
});
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);
});
You can import a file directly from a URL by describing the url
where 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);
});
- Functions to get the oAuth tokens
- Import directly from other storage services