ks3-utils
v0.0.4
Published
金山云对象存储(ks3)工具包
Downloads
14
Maintainers
Readme
KS3-Utils
金山云对象存储(ks3)工具包
基础用法
index.ts
import KS3Utils from 'ks3-utils'
const utils = new KS3Utils({
ak: 'ak',
sk: 'sk',
bucket: 'default',
region: 'BEIJING',
headers: [
'x-kss-acl:public-read'
]
})
const url = await utils.uploadFile({
file: '/path/to/file'
})
从.env
文件读取配置
.env文件
KS3_AK=<your ak>
KS3_SK=<your sk>
KS3_BUCKET=<your bucket>
KS3_REGION=beijing
KS3_HEADERS=x-kss-acl:public-read,x-kss-acl:public-write
index.ts
import KS3Utils, { config } from 'ks3-utils'
const utils = new KS3Utils(config)
const url = await utils.uploadFile({
file: '/path/to/file'
})