meocloud
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 = config;
Search for file
var meocloud = config; var params = query: 'my_search_term'; meocloud;
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 = config; var params = {}; // add here only the MEOCloud API params meocloud;
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 = config;var fs = ; fs;
More samples coming soon ...
Documentation
callback(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
metadata(path, params, cb)
path
(string) the path the file / folder to retrieve info fromparams
(hash) the params to send in the GET URIfile_limit
limit the number of files to list (ifpath
is a folder)hash
if you need to check for file changeslist
true
if you want to list files inside the folder,false
otherwiseinclude_deleted
true
if you want to list deleted filesrev
if you want a specific version of the file/folder
cb
(function) the callback function
metadataShare(shareID, path, params, cb)
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_limit
the limit of files to be listed
cb
(function) the callback function
listLinks(cb)
cb
(function) the callback function
deleteLink(params, cb)
params
(hash) the params to send in the requestshareid
the ID of the file share (required)
cb
(function) the callback function
shares(path, cb)
path
(string) the path to get all shares fromcb
(function) the callback function
shareFolder(path, params, cb)
path
(string) the path of the file/folder to shareparams
(hash) the params to send in the requestto_email
the email of the user to share the folder with (required)
cb
(function) the callback function
listSharedFolders(cb)
cb
(function) the callback function
thumbnails(path, params, cb)
path
(string) the path of the file to fetch the thumbnailparams
(hash) the params to send in the requestformat
the format of the thumb image file (png
orjpeg
)size
the size of the thumbnail (xs
,s
,m
,l
,xl
)
cb
(function) the callback function
search(path, params, cb)
path
(string) the path where to start the searchparams
(hash) the params to send in the requestquery
the term to search for (required)mime_type
the mime type of the files to search forfile_limit
the number of files to returninclude_deleted
true
if it should search for deleted files
cb
(function) the callback function
revisions(path, params, cb)
path
(string) path to the file/folderparams
(hash) the params to send in the requestrev_limit
the number of revisions to return
cb
(function) the callback function
restore(path, params, cb)
path
(string) path of the deleted file/folder to restoreparams
(hash) the params to send in the requestrev
the revision to restore the file to (required)
cb
(function) the callback function
media(path, params, cb)
path
(string) path of the file/folder to get the media fromparams
(hash) the params to send in the requestdownload_fallback
true if you want to revert to download on failureprotocol
the streaming protocol (hls
,rtmp
,rtsp
,ss
)
cb
(function) the callback function
getFile(path, params, cb)
path
(string) the path of the file to get/downloadparams
(hash) the params to send in the requestrev
revision of the version of the file to get
cb
(function) the callback function
putFile(path, fileStream, fileSize, params, cb)
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 requestoverwrite
true
if you want to overwrite an already existing file path (requires parent_rev)parent_rev
if you want to overwrite, add the latest rev of the file (requires overwrite)
cb
(function) the callback function
upload(origin, destination, params, cb)
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 requestoverwrite
true
if you want to overwrite an already existing file path (requires parent_rev)parent_rev
if you want to overwrite, add the latest rev of the file (requires overwrite)
cb
(function) the callback function
delta(params, cb)
params
(hash) the params to send in the requestcursor
only changes after this cursor will be listed
cb
(function) the callback function
copy(params, cb)
params
(hash) the params to send in the requestroot
choosemeocloud
orsandbox
. default ismeocloud
.from_path
origin path of the file / folder (required)to_path
destination path of the file / folder (required)from_copy_ref
a reference to a shared file from other user
cb
(function) the callback function
copyRef(path, cb)
path
(string) path to the filecb
(function) the callback function
delete(params, cb)
params
(hash) the params to send in the requestpath
the path of the file / folder to remove (required)root
choosemeocloud
orsandbox
. default ismeocloud
.
cb
(function) the callback function
move(params, cb)
params
(hash) the params to send in the requestfrom_path
the path of the file / folder to move (required)to_path
the destination path of the file / folder to move (required)root
choosemeocloud
orsandbox
. default ismeocloud
.
cb
(function) the callback function
createFolder(params, cb)
params
(hash) the params to send in the requestpath
the path of the new folder (required)root
choosemeocloud
orsandbox
. default ismeocloud
.
cb
(function) the callback function
undeleteTree(path, cb)
path
(string) the path of the file / folder to recoverparams
(hash) the params to send in the requestroot
choosemeocloud
orsandbox
. default ismeocloud
.
cb
(function) the callback function
accountInfo(cb)
cb
(function) the callback function
License
Copyright (c) 2013 Rogério Vicente. Licensed under the MIT license.