@azm-library/cos-node
v2.0.3
Published
> TODO: description
Downloads
27
Readme
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);