bos-sdk-front-end
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

bos-sdk-front-end

安装

 npm install bos-sdk-js-front-end

使用

基础

import Upload from 'bos-sdk-front-end';

const upload = new Upload(tokenUrl, {
  credentials: {
    ak: '', // require
    sk: '', // require
  },
  endpoint: '', // require
  sessionToken: '', // require
  bucket: '',
})

const url = await upload.putObjectFromBlob(file)// endpoint + bucket + hashname

指定文件hashname

const url = await upload.putObjectFromBlob(file, key)// endpoint + bucket + key

得到文件详细信息

const fileInfo = await upload.putObjectFromBlob(file, key, true)

最佳使用方式

  从后端获取时效性sessinoToken,前端使用sessionToken上传,防止前端ak,ak泄漏

Readme

Keywords

Package Sidebar

Install

npm i bos-sdk-front-end

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

5.08 kB

Total Files

6

Last publish

Collaborators

  • taniffer