📜  如何使用 node.js 和 Express 上传文件到阿里云 OSS - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:17.111000             🧑  作者: Mango

代码示例1
var co = require('co');
var OSS = require('ali-oss');

var client = new OSS({
  region: '',
  accessKeyId: '',
  accessKeySecret: '',
  bucket: 'Your bucket name'
});

co(function* () {
  var result = yield client.put('object-key', new Buffer('hello world'));
  console.log(result);
}).catch(function (err) {
  console.log(err);
});