Giter Club home page Giter Club logo

qcloud-internal-cos's Introduction

qcloud-internal-cos

nodejs sdk for [腾讯云COS服务]

安装

npm install qcloud-internal-cos

指定您的配置

修改conf.js中的配置信息或者如下设置

qcloud_cos.conf.setAppInfo('000000', 'xxxxxxxx', 'xxxxxxx');

程序示例

var qcloud = require('qcloud-internal-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)});

qcloud-internal-cos's People

Contributors

miusuncle avatar tomleader avatar wangnan8791 avatar 184565673 avatar cliffordsun avatar

Stargazers

HaveF avatar

Watchers

James Cloos avatar  avatar  avatar

qcloud-internal-cos's Issues

你好!

我的是node+express,使用你的这儿一直返回这样的:
{ httpcode: 0, code: -2, message: 'recv timeout', data: {} }
{ httpcode: 0, code: -2, message: 'socket hang up', data: {} }
腾讯那边也找不到node的SDK了。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.