# @azm-library/cos-node

> > TODO: description

Latest version **2.0.3** (published 2021-12-31) · ISC license · 0 weekly downloads

## Install

```sh
npm install @azm-library/cos-node
pnpm add @azm-library/cos-node
yarn add @azm-library/cos-node
bun add @azm-library/cos-node
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2021-12-31 |
| First published | 2021-12-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 25.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | aaron |
| Maintainers | aaron-zm |

## Links

- npm: https://www.npmjs.com/package/@azm-library/cos-node
- npm.io page: https://npm.io/package/@azm-library/cos-node

## Dependencies (2)

- [dayjs](https://npm.io/package/dayjs.md) ^1.10.7
- [qcloud-cos-sts](https://npm.io/package/qcloud-cos-sts.md) ^3.0.6

## Recent versions

- 2.0.3 (latest) — 2021-12-31
- 2.0.1 — 2021-12-31
- 2.0.0 — 2021-12-31
- 1.0.3 — 2021-12-30
- 1.0.2 — 2021-12-27
- 1.0.1 — 2021-12-13
- 1.0.0 — 2021-12-13

## README

# cos-node 工具

## 安装

```shell
# 通过 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

```ts
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;
  };
}>;
```

- 示例代码

```js
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);
```

---
_Source: https://npm.io/package/@azm-library/cos-node · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
