2.0.3 • Published 2 years ago

@azm-library/cos-node v2.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

cos-node 工具

安装

# 通过 npm 安装
npm i @azm-library/cos-node -S

# 通过 yarn 安装
yarn add @azm-library/cos-node -S

# 通过 pnpm 安装
pnpm add @azm-library/cos-node -S

methods

makeCosCredential

  • 描述:生成鉴权相关信息
  • 类型:MakeCosCredential
interface MakeCosCredentialOpt {
  region: string;
  bucket: string;
  prefix: string;
  secretId: string;
  secretKey: string;
}

type MakeCosCredential = (options: MakeCosCredentialOpt) => Promise<{
  startTime: number;
  expiredTime: number;
  credentials: {
    tmpSecretId: string;
    tmpSecretKey: string;
    sessionToken: string;
  };
}>;
  • 示例代码
import { makeCosCredential } from '@pagoda-tools/node-helper';
const data = await makeCosCredential({
  region: 'xxx',
  bucket: 'xxx',
  prefix: 'xxxx',
  secretId: 'xxxx',
  secretKey: 'xxxx',
});

/*
{
  startTime: 1634030589,
  expiredTime: 1634032389,
  credentials: {
    tmpSecretId: 'xxxxxx',
    tmpSecretKey: 'xxxxx',
    sessionToken: 'xxxxxx'
  };
}
*/
console.log(data);
2.0.3

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago