UNPKG

ks3

Version:

本代码库为`金山云存储KS3`服务.主要提供`KS3 nodejs SDK`和`命令行工具`.

85 lines (83 loc) 2.24 kB
var path = require('path'); var version = require('./package.json').version module.exports = { protocol:'http', baseUrl:'ks3-cn-beijing.ksyuncs.com', // 所有header设置的前缀 // ks3: kss , amazon s3: amz prefix:'kss', // 返回的数据格式,默认为xml,因为aws返回的全是xml, // 不过鉴于nodejs对于json的喜爱,可以在config中设置为`json` // ['xml','json'] dataType: 'xml', // 默认返回的是这个格式 // 非必要,不传递也不会报错 //contentType:'application/xml', contentType:'', // 设置通过`user-agent`头信息 ua:'KS3_NodeJS' + '/' + version, // 简单文件上传的最大限制 uploadMaxSize : 5*1024*1024*1024, // 分块上传的最小单位 chunkSize: 5*1024*1024, // 最大的分块数 chunkMaxNum: 10000, //文件分块上传阈值下线 multipartUploadMinSize: 100 * 1024 * 1024, // 100 MB // 高级上传失败重试次数 retries: 5, // 上传文件信息缓存地址 cachePath:path.join(__dirname,'./cache/files/'), // 区域 region:'BEIJING', // 是否开启上传文件CRC64校验 uploadCheckCRC: true, /** * endpoint * 对应关系详见:https://docs.ksyun.com/documents/6761 */ ENDPOINT : { /** * @deprecated */ HANGZHOU : 'kss.ksyuncs.com', /** * @deprecated */ AMERICA: 'ks3-us-west-1.ksyuncs.com', BEIJING : 'ks3-cn-beijing.ksyuncs.com', HONGKONG: 'ks3-cn-hk-1.ksyuncs.com', SHANGHAI: 'ks3-cn-shanghai.ksyuncs.com', GUANGZHOU: 'ks3-cn-guangzhou.ksyuncs.com', RUSSIA: 'ks3-rus.ksyuncs.com', SINGAPORE: 'ks3-sgp.ksyuncs.com', JR_BEIJING: 'ks3-jr-beijing.ksyuncs.com', JR_SHANGHAI: 'ks3-jr-shanghai.ksyuncs.com', /** * @deprecated */ GOV_BEIJING: 'ks3-gov-beijing.ksyuncs.com' }, isDebug: false, // 调试 setRegion: function(region) { const tmp = this.ENDPOINT[region]; if (tmp) { this.baseUrl = tmp this.region = region this.endpoint = tmp } else { this.setEndpoint(tmp) } }, resetRegion: function(){ this.baseUrl = this.ENDPOINT.BEIJING; this.region = ''; this.endpoint = ''; }, setEndpoint: function (endpoint) { if (endpoint) { this.baseUrl = endpoint this.endpoint = endpoint } } }