@blueshit/cos-client
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

cos-client

腾讯云 COS 客户端

Install

const COSClient = require("@blueshit/cos-client").default;

const client = new COSClient({
  appId: "xxxxx",
  secretId: "xxxxx",
  secretKey: "xxxxx",
  bucket: "test",
  region: "ap-guangzhou",
  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);

/@blueshit/cos-client/

    Package Sidebar

    Install

    npm i @blueshit/cos-client

    Weekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    13.2 kB

    Total Files

    5

    Last publish

    Collaborators

    • leizongmin
    • yourtion