不用node.js的Buffer,如果在浏览器方式中上传字符串到OSS中?
可以参考官方文档 https://help.aliyun.com/document_detail/64047.html?spm=a2c4g.11174283.6.965.19ed7da2tJQIQplet OSS = require('ali-oss');
let client = new OSS({
region: '',
accessKeyId: '',
accessKeySecret: '',
bucket: 'Your bucket name'
});
async function putBlob () {
try {
let result = await client.put('object-key', new Blob(['content'],{ type: 'text/plain' }));
console.log(result);
} catch (e) {
conosle.log(e);
}
}
putBlob();
赞0
踩0