Home

Awesome

meocloud Build Status

Greenkeeper badge

MEOCloud api wrapper.

Getting Started

npm install meocloud --save

Some Examples

Config

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);

Search for file

var meocloud = require('meocloud')(config);

var params = {
    query: 'my_search_term'
};

meocloud.search('/', params, function(err, data, status) {
    console.log(err, data, status);
});

File Upload

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);
    });

});
More samples coming soon ...

Documentation

callback(err, data, status)

These are the arguments sent to every callback passed to this lib:

metadata(path, params, cb)

metadataShare(shareID, path, params, cb)

listLinks(cb)

deleteLink(params, cb)

shares(path, cb)

shareFolder(path, params, cb)

listSharedFolders(cb)

thumbnails(path, params, cb)

search(path, params, cb)

revisions(path, params, cb)

restore(path, params, cb)

media(path, params, cb)

getFile(path, params, cb)

putFile(path, fileStream, fileSize, params, cb)

upload(origin, destination, params, cb)

delta(params, cb)

copy(params, cb)

copyRef(path, cb)

delete(params, cb)

move(params, cb)

createFolder(params, cb)

undeleteTree(path, cb)

accountInfo(cb)

License

Copyright (c) 2013 Rogério Vicente. Licensed under the MIT license.