下载到本地内存

本文介绍如何将 OSS 文件下载到本地内存。

您可以通过get接口简单地将 OSS 文件下载到本地内存:

let OSS = require('ali-oss');

let client = new OSS({
  region: '<Your region>',
  accessKeyId: '<Your AccessKeyId>',
  accessKeySecret: '<Your AccessKeySecret>',
  bucket: 'Your bucket name'
});

async function getBuffer () {
  try {
    let result = await client.get('object-name');
    console.log(result.content);
  } catch (e) {
    console.log(e);
  }
}

getBuffer();

发布者:佚, 佚名,转转请注明出处:https://www.cms2.cn/aliyun/3119.html

发表评论

邮箱地址不会被公开。 必填项已用*标注