-
Notifications
You must be signed in to change notification settings - Fork 3
js sdk readme
xianjimli edited this page May 23, 2014
·
4 revisions
js-sdk-for-UPYUN 是为UPYUN(又拍云)开发的JavaScript SDK,开发人员可以在浏览器中直接使用UPYUN(又拍云)的AP 化WebApp存储方面的工作量。
函数原型:
function getUpYunClient();
参数说明:
- bucket bucket名称
- username 用户名
- password 密码
- onDone 完成时的回调函数,函数原型:onDone = function(result, message)。result为true表示成功,false表示失败。
示例代码:
var upyun = getUpYunClient();
函数原型:
function getUpYunClient();
参数说明:
- bucket bucket名称
- username 用户名
- password 密码
- onDone 完成时的回调函数,函数原型:onDone = function(result, message)。result为true表示成功,false表示失败。
示例代码:
upyun.login("www.drawapp8.com", "drawapp8", "123456", function(result, message) {
//TODO:
});
函数原型:
UpYun.prototype.writeFile = function(path, file, onDone, options)
参数说明:
- path 全路径文件名
- file 文件句柄(通过让用户选择获得)。
- onDone 完成时的回调函数,函数原型:onDone = function(result, message)。result为true表示成功,false表示失败。
- options 选项(数组),具体请参考接口文档。
示例代码:
upyun.writeFile("/test.txt", file, function(result, message) {
//TODO:
});
(对于创建内容的WebApp非常有用,可以方便的把生成的数据存到UPYUN(又拍云)上)
函数原型:
UpYun.prototype.writeData = function(path, data, onDone, options)
参数说明:
- path 全路径文件名
- file 文件句柄(通过让用户选择获得)。
- onDone 完成时的回调函数,函数原型:onDone = function(result, message)。result为true表示成功,false表示失败。
- options 选项(数组),具体请参考接口文档。
示例代码:
upyun.writeData("/test.txt", data, function(result, message) {
//TODO:
});
函数原型:
UpYun.prototype.read = function(path, onDone)
参数说明:
- path 全路径文件名
- onDone 完成时的回调函数,函数原型:onDone = function(path, content)。content为文件内容。
示例代码:
upyun.read("/test.txt", function(path, content) {
//TODO:
});
函数原型:
UpYun.prototype.getFileInfo = function(path, onDone)
参数说明:
- path 全路径文件名
- onDone 完成时的回调函数,函数原型:onDone = function(result, message, data)。result为true表示成功,false表示失败。
示例代码:
upyun.getFileInfo("/test.txt", function(result, message, data) {
//TODO:
});
函数原型:
UpYun.prototype.delete = function(path, onDone)
参数说明:
- path 全路径文件名
- onDone 完成时的回调函数,函数原型:onDone = function(result, message)。result为true表示成功,false表示失败。
示例代码:
upyun.delete("/test.txt", function(result, message) {
//TODO:
});
函数原型:
UpYun.prototype.makeDir = function(path, onDone)
参数说明:
- path 全路径文件名
- onDone 完成时的回调函数,函数原型:onDone = function(result, message)。result为true表示成功,false表示失败。
示例代码:
upyun.makeDir("/abc", function(result, message) {
//TODO:
});
函数原型:
UpYun.prototype.list = function(path, onDone)
参数说明:
- path 全路径文件名
- onDone 完成时的回调函数,函数原型:onDone = function(result, message, data)。result为true表示成功,false表示失败。
示例代码:
upyun.list("/", function(result, message, data) {
//TODO:
});
函数原型:
UpYun.prototype.getFolderUsage = function(path, onDone)
参数说明:
- path 全路径文件名
- onDone 完成时的回调函数,函数原型:onDone = function(result, message, data)。result为true表示成功,false表示失败。
示例代码:
upyun.getFolderUsage("/", function(result, message, data) {
//TODO:
});
函数原型:
UpYun.prototype.copy = function(srcName, dstName, onDone)
参数说明:
- srcName 全路径源文件名
- dstName 全路径目的文件名
- onDone 完成时的回调函数,函数原型:onDone = function(result, message)。result为true表示成功,false表示失败。
示例代码:
upyun.copy("/src.txt", "/dst.txt", function(result, message) {
//TODO:
});
函数原型:
UpYun.prototype.move = function(srcName, dstName, onDone)
参数说明:
- srcName 全路径源文件名
- dstName 全路径目的文件名
- onDone 完成时的回调函数,函数原型:onDone = function(result, message)。result为true表示成功,false表示失败。
示例代码:
upyun.move("/src.txt", "/dst.txt", function(result, message) {
//TODO:
});
函数原型:
UpYun.prototype.rename = function(srcName, dstName, onDone)
参数说明:
- srcName 全路径源文件名
- dstName 全路径目的文件名
- onDone 完成时的回调函数,函数原型:onDone = function(result, message)。result为true表示成功,false表示失败。
示例代码:
upyun.rename("/src.txt", "/dst.txt", function(result, message) {
//TODO:
});
函数原型:
UpYun.prototype.isLogined = function(onDone)
参数说明:
- onDone 完成时的回调函数,函数原型:onDone = function(result, message)。result为true表示成功,false表示失败。
示例代码:
upyun.isLogined(function(result, message) {
//TODO:
});
函数原型:
UpYun.prototype.logout = function(onDone)
参数说明:
- onDone 完成时的回调函数,函数原型:onDone = function(result, message)。result为true表示成功,false表示失败。
示例代码:
upyun.logout(function(result, message) {
//TODO:
});