Skip to content

Cell - OSS Component ​

ObjectStorageService of @celljs/cloud on Alibaba Cloud OSS, with the ali-oss SDK.

bash
npm install @celljs/oss
yaml
cloud:
  region: cn-hangzhou            # the client uses 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 passes extra options to the ali-oss client (endpoint, internal, timeout, ...). See @celljs/cloud for the interface and the credential sources.