youku-uploader
v1.0.4
Published
youku could upload nodejs sdk.
Downloads
5
Readme
youku-upload-sdk
优酷云视频上传sdk-nodejs
###Installation
$ nam install youku-uploader -save
###Exapmle
let YoukuUploader = require('youku-uploader');
let config = {
client_id : 'YOUR CLIENT_ID',
client_secret : 'YOUR CLIENT_SECRET',
access_token : 'ACCESS_TOKEN',
refresh_token : 'REFRESH_TOKEN'
}
let file = 'file_path';
let uploader = new youku(config);
let info = {
title : 'hello test',
tags : 'basketball,sport',
file_name : file
}
//开始上传文件
uploader.startUpload(info,function(err, progress, id){
if (err) {
console.log(err);
} else if(progress) {
console.log(progress); //进度
}
if (id) {
console.log(id) //上传完成返回视频id
}
})
setTimeout(function(){
//取消上传
uploader.cancelUpload(function(err, result) {
if (err) {
console.log(err);
} else {
console.log(result);
}
})
},5000)
###YoukuUploader ####.startUpload(info[,callback]) 开始上传
####.cancelUpload(callback) 取消上传