Skip to content

轻量级阿里云OSS客户端,体验飞一般的感觉

License

Notifications You must be signed in to change notification settings

npmshit/oss-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oss-client

阿里云 OSS 客户端

Install

const OSSClient = require("@blueshit/oss-client").default;

const client = new OSSClient({
  accessKeyId: "xxxxx",
  accessKeySecret: "xxxxxxx",
  bucket: "test",
  endpoint: "oss-cn-shenzhen.aliyuncs.com",
  prefix: "test/"
});

// 通过 Buffer 上传
const data = fs.readFileSync("icon.png");
client.putObject("icon.png", data)
  .then(console.log)
  .catch(console.log);

// 通过 Stream 上传
const stream = fs.createReadStream("icon.png");
client.putObject("icon.png", stream)
  .then(console.log)
  .catch(console.log);

About

轻量级阿里云OSS客户端,体验飞一般的感觉

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published