@celljs/oss 4.6.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.zh-cn.md +25 -0
  2. package/package.json +3 -3
@@ -0,0 +1,25 @@
1
+ # Cell - OSS 组件
2
+
3
+ [`@celljs/cloud`](../cloud) 的 `ObjectStorageService` 在 [阿里云 OSS](https://www.alibabacloud.com/product/object-storage-service) 上,使用 `ali-oss` SDK。
4
+
5
+ ```bash
6
+ npm install @celljs/oss
7
+ ```
8
+
9
+ ```yaml
10
+ cloud:
11
+ region: cn-hangzhou # 客户端使用 oss-<region>
12
+ credentials:
13
+ accessKeyId: "${env.ALIBABA_CLOUD_ACCESS_KEY_ID}"
14
+ accessKeySecret: "${env.ALIBABA_CLOUD_ACCESS_KEY_SECRET}"
15
+ ```
16
+
17
+ ```ts
18
+ @Autowired(ObjectStorageService)
19
+ protected readonly storage: ObjectStorageService<OSS>;
20
+
21
+ await this.storage.putObject({ bucket: 'my-bucket', key: 'a.txt', body: 'hello' });
22
+ const body = await this.storage.getObject({ bucket: 'my-bucket', key: 'a.txt' });
23
+ ```
24
+
25
+ `cloud.client` 把额外的选项传给 `ali-oss` 客户端(`endpoint`、`internal`、`timeout`、...)。见 [@celljs/cloud](../cloud) 了解接口和凭据来源。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/oss",
3
- "version": "4.6.0",
3
+ "version": "4.7.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "cell-component"
@@ -31,8 +31,8 @@
31
31
  "watch": "tsc -b -w --preserveWatchOutput"
32
32
  },
33
33
  "dependencies": {
34
- "@celljs/cloud": "4.6.0",
35
- "@celljs/core": "4.6.0",
34
+ "@celljs/cloud": "4.7.0",
35
+ "@celljs/core": "4.7.0",
36
36
  "@types/ali-oss": "^6.0.5",
37
37
  "ali-oss": "^6.23.0"
38
38
  },