Cell - OSS 组件
@celljs/cloud 的 ObjectStorageService 在 阿里云 OSS 上,使用 ali-oss SDK。
bash
npm install @celljs/ossyaml
cloud:
region: cn-hangzhou # 客户端使用 oss-<region>
credentials:
accessKeyId: "${env.ALIBABA_CLOUD_ACCESS_KEY_ID}"
accessKeySecret: "${env.ALIBABA_CLOUD_ACCESS_KEY_SECRET}"ts
@Autowired(ObjectStorageService)
protected readonly storage: ObjectStorageService<OSS>;
await this.storage.putObject({ bucket: 'my-bucket', key: 'a.txt', body: 'hello' });
const body = await this.storage.getObject({ bucket: 'my-bucket', key: 'a.txt' });cloud.client 把额外的选项传给 ali-oss 客户端(endpoint、internal、timeout、...)。见 @celljs/cloud 了解接口和凭据来源。