求问oss jssdk中put方法!
发布于 7 年前 作者 centmaster 3274 次浏览 来自 问答

client.put(‘object’, ‘/tmp/file’).then(function (val) { console.log(val.res); return client.get(‘object’); }).then(function (val) { console.log(val.res); console.log(val.content.toString()); });

求问这段代码中的’object’, '/tmp/file’两个参数第一个是名称,第二个是文件位置,我理解的对吗? 试了好几种方法都会报以下三个错 1.argument must be a string, Buffer, ArrayBuffer, Array, or array-like object. 2.You have no right to access this object because of bucket acl. 3.s.createReadStream is not a function

2 回复

求助啊

第一个参数是上传后的object名称,如:a.txt;第二个参数是对应的文件buffer或stream,如fs.readFile((data)=>{})中的data或第三方模块busboy解析出的上传流; bucket acl设置为public试试

回到顶部