MEOCloud api wrapper.
npm install meocloud --save
var config = {
oauth: {
consumer_key: 'xxxxxxxxxxxxxx',
consumer_secret: 'xxxxxxxxxxxx',
token: 'xxxxxxxxxxxxxx',
token_secret: 'xxxxxxxxxxxxxx';
},
root: 'meocloud', // or sandbox
noSSL: true // default: false
}
var meocloud = require('meocloud')(config);var meocloud = require('meocloud')(config);
var params = {
query: 'my_search_term'
};
meocloud.search('/', params, function(err, data, status) {
console.log(err, data, status);
});There's two ways to make file uploads.
The first way, uses a helper method that takes care of all the details for you. If you don't need much flexibility, just use this:
var meocloud = require(meocloud)(config);
var params = {}; // add here only the MEOCloud API params
meocloud.upload('/file/to/upload.txt', '/new/file/path.txt', params, function(err, data, status) {
console.log(err, data, status);
});The second one, gives you enough flexibility to adapt to your project, but requires you to provide all the code to deal with files, and returns the request object so you can add event listeners to control the progress or whatever. Here's an example:
var meocloud = require('meocloud')(config);
var fs = require('fs');
fs.stat('/file/to/upload.txt', console.log(err, stat) {
if (err) { throw err; }
var fstream = fs.createReadStream('/file/to/upload.txt');
var params = { overwrite: true };
meocloud.putFile('/new/file/path.txt', fstream, stat.size, params, function(err, data, status) {
console.log(err, data, status);
});
});These are the arguments sent to every callback passed to this lib:
err(object) if an error occurred, this param will existdata(object) the parsed JSON object from the API responsestatus(integer) the http status returned from the API response
path(string) the path the file / folder to retrieve info fromparams(hash) the params to send in the GET URIfile_limitlimit the number of files to list (ifpathis a folder)hashif you need to check for file changeslisttrueif you want to list files inside the folder,falseotherwiseinclude_deletedtrueif you want to list deleted filesrevif you want a specific version of the file/folder
cb(function) the callback function
shareID(string) the ID of the shared file (returned by the API when sharing)path(string) the path to the shared fileparams(hash) the params to send in the requestfile_limitthe limit of files to be listed
cb(function) the callback function
cb(function) the callback function
params(hash) the params to send in the requestshareidthe ID of the file share (required)
cb(function) the callback function
path(string) the path to get all shares fromcb(function) the callback function
path(string) the path of the file/folder to shareparams(hash) the params to send in the requestto_emailthe email of the user to share the folder with (required)
cb(function) the callback function
cb(function) the callback function
path(string) the path of the file to fetch the thumbnailparams(hash) the params to send in the requestformatthe format of the thumb image file (pngorjpeg)sizethe size of the thumbnail (xs,s,m,l,xl)
cb(function) the callback function
path(string) the path where to start the searchparams(hash) the params to send in the requestquerythe term to search for (required)mime_typethe mime type of the files to search forfile_limitthe number of files to returninclude_deletedtrueif it should search for deleted files
cb(function) the callback function
path(string) path to the file/folderparams(hash) the params to send in the requestrev_limitthe number of revisions to return
cb(function) the callback function
path(string) path of the deleted file/folder to restoreparams(hash) the params to send in the requestrevthe revision to restore the file to (required)
cb(function) the callback function
path(string) path of the file/folder to get the media fromparams(hash) the params to send in the requestdownload_fallbacktrue if you want to revert to download on failureprotocolthe streaming protocol (hls,rtmp,rtsp,ss)
cb(function) the callback function
path(string) the path of the file to get/downloadparams(hash) the params to send in the requestrevrevision of the version of the file to get
cb(function) the callback function
path(string) the path where the file will be savedfileStream(readable stream) the stream of the file to be uploadedfileSize(integer) the size, in bytes, of the file to be uploadedparams(hash) the params to send in the requestoverwritetrueif you want to overwrite an already existing file path (requires parent_rev)parent_revif you want to overwrite, add the latest rev of the file (requires overwrite)
cb(function) the callback function
origin(string) the path of the file to be uploadeddestination(string) the path where the file will be savedparams(hash) the params to send in the requestoverwritetrueif you want to overwrite an already existing file path (requires parent_rev)parent_revif you want to overwrite, add the latest rev of the file (requires overwrite)
cb(function) the callback function
params(hash) the params to send in the requestcursoronly changes after this cursor will be listed
cb(function) the callback function
params(hash) the params to send in the requestrootchoosemeocloudorsandbox. default ismeocloud.from_pathorigin path of the file / folder (required)to_pathdestination path of the file / folder (required)from_copy_refa reference to a shared file from other user
cb(function) the callback function
path(string) path to the filecb(function) the callback function
params(hash) the params to send in the requestpaththe path of the file / folder to remove (required)rootchoosemeocloudorsandbox. default ismeocloud.
cb(function) the callback function
params(hash) the params to send in the requestfrom_paththe path of the file / folder to move (required)to_paththe destination path of the file / folder to move (required)rootchoosemeocloudorsandbox. default ismeocloud.
cb(function) the callback function
params(hash) the params to send in the requestpaththe path of the new folder (required)rootchoosemeocloudorsandbox. default ismeocloud.
cb(function) the callback function
path(string) the path of the file / folder to recoverparams(hash) the params to send in the requestrootchoosemeocloudorsandbox. default ismeocloud.
cb(function) the callback function
cb(function) the callback function
Copyright (c) 2013 Rogério Vicente. Licensed under the MIT license.
