This document describes how to upload content from local memory to OSS.

Note The following sample code uses the catch syntax. Learn ES6 Promise and ES6 Async/Await on your own. For more information about how to use the SDK, see Installation.

You can use put to upload content from local memory to 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 putBuffer () {
  try {
    let result = await client.put('object-name', new Buffer('hello world'));
  } catch (e) {