# qcloud_cos

> node sdk for qcloud

Latest version **1.0.6** (published 2016-09-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install qcloud_cos
pnpm add qcloud_cos
yarn add qcloud_cos
bun add qcloud_cos
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2016-09-05 |
| First published | 2015-07-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | tencentyun |
| Maintainers | cliffordsun, linktang |
| Keywords | qcloud |

## Links

- npm: https://www.npmjs.com/package/qcloud_cos
- Repository: https://github.com/tencentyun/cos-nodejs-sdk
- Homepage: https://github.com/tencentyun/cos-nodejs-sdk#readme
- Issues: https://github.com/tencentyun/cos-nodejs-sdk/issues
- npm.io page: https://npm.io/package/qcloud_cos

## Dependencies (1)

- [formstream](https://npm.io/package/formstream.md) 0.0.7

## Recent versions

- 1.0.6 (latest) — 2016-09-05
- 1.0.5 — 2016-08-30
- 1.0.4 — 2015-12-25
- 1.0.3 — 2015-11-03
- 1.0.2 — 2015-09-28
- 1.0.1 — 2015-07-30
- 1.0.0 — 2015-07-29

## README

# qcloud_cos-node
nodejs sdk for [腾讯云COS服务]

## 安装
npm install qcloud_cos

## 指定您的配置
修改conf.js中的配置信息或者如下设置
```javascript
qcloud_cos.conf.setAppInfo('000000', 'xxxxxxxx', 'xxxxxxx');
```

## 程序示例
```javascript
var qcloud = require('qcloud_cos');

qcloud.conf.setAppInfo('100000', 'AKIDoooooooooooooooooooooooooooooooo', 'ROllllllllllllllllllllllllllllll');

/*
* 各接口的callback 为单个参数的function： function(ret){}
* ret 为 {'code':0,'message':'ok','data':{}} 的对象，其中data的内容依接口有所不同
*/
//上传文件
qcloud.cos.upload('/tmp/test.txt', 'bucket', 'text/1.txt','new myattr',1, function(ret){
    if (ret.code != 0) {
        console.log(ret);
    }else{
        // 查询文件
        qcloud.cos.statFile('bucket', 'text/1.txt', function(ret) {
            console.log(ret);
        });
        // 删除文件
        qcloud.cos.deleteFile('bucket', 'text/1.txt', function(ret) {
            console.log(ret);
        });
    }
});

//创建目录
qcloud.cos.createFolder('bucket', '/firstDir/');

//获取指定目录下文件列表
qcloud.cos.list('bucket', '/firstDir/', 20, 'eListFileOnly');

//获取bucket下文件列表
qcloud.cos.list('bucket', '/', 20, 'eListFileOnly');

//获取指定目录下以'abc'开头的文件
qcloud.cos.prefixSearch('bucket', '/firstDir/', 'abc', 20, 'eListFileOnly');

//设置文件权限以及自定义header
var headers = {
        "Cache-Control": "no-cache",
        "Content-Type" : "application/json",
        "Content-Encoding" : "utf-8"
    };
    
qcloud_cos.cos.updateFile('0001', '123/test_slice.dat', 'newattr', 'eWRPrivate', headers, function(ret) {console.log(ret)});

```

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