1.0.21 • Published 4 years ago

@bj-nsc/upload v1.0.21

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

前文

由于项目需求变更,此前使用ali-oss库直传文件到阿里云 OSS 中心的方式不再支持,为了方便各专业尽量少改动代码,此包应运而生。

安装

npm install @bj-nsc/upload --save

使用方式

import OSS from "@bj-nsc/upload";

const client = new OSS();

// 所有这些配置都是可选的
const config = {
  serviceName: "eic-team-review", //服务名
  busiName: "users", // 业务名
  apiPrefix: "", // api前缀, 默认是/api,如果不需要加任何前缀请传空字符串
  url: "", // 文件上传接口地址, 当设置此属性时apiPrefix失效
  headers: {
    Authorization: "",
  },
  timeout: 1000, // 上传超时设置
  progress: function (value) {}, // 上传进度回调
};

client
  .multipartUpload("file", file, config)
  .then((res) => {
    // 上传成功
    const { name, bucket, etag, requestUrl } = res;
  })
  .catch((error) => {
    // 上传失败
  });
1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.10

4 years ago

1.0.1

4 years ago