serverpod_cos 0.1.3 copy "serverpod_cos: ^0.1.3" to clipboard
serverpod_cos: ^0.1.3 copied to clipboard

Serverpod helpers for Tencent Cloud COS.

serverpod_cos #

Tencent COS helper for Serverpod (passwords.yaml -> presigned URL).

Features #

  • Read COS config from passwords.yaml
  • session.cosSigner() in one line
  • Optional generic endpoint
dependencies:
  serverpod_cos: ^0.1.0

passwords.yaml #

shared:
  tencentCosSecretId: '<TENCENT_SECRET_ID>'
  tencentCosSecretKey: '<TENCENT_SECRET_KEY>'
  tencentCosBucket: '<COS_BUCKET_NAME>'
  tencentCosRegion: '<COS_REGION>'
  tencentCosCustomDomain: 'https://my-cdn.example.com' # optional

Official storage compatibility #

This package uses presigned URLs + custom endpoints. For official CloudStorage API compatibility, use:

dependencies:
  serverpod_cloud_storage_cos: ^0.1.0

Usage #

import 'package:serverpod/serverpod.dart';
import 'package:serverpod_cos/serverpod_cos.dart';

class MyEndpoint extends Endpoint {
  Future<String> createUploadUrl(Session session, String objectKey) async {
    final signer = session.cosSigner();
    return signer.generatePresignedUrl(
      'PUT',
      objectKey,
      expires: 3600,
    );
  }
}

Custom password keys #

final signer = session.cosSigner(
  keys: const CosPasswordKeys(
    secretId: 'myCosSecretId',
    secretKey: 'myCosSecretKey',
    bucket: 'myCosBucket',
    region: 'myCosRegion',
    customDomain: 'myCosCustomDomain',
  ),
);

Optional endpoint #

class CosEndpoint extends ServerpodCosEndpoint {}

Maintenance #

  • Optional/advanced package; no feature expansion planned.
  • Versioning: SemVer
  • Feedback: issue / PR (not guaranteed timely)
0
likes
0
points
234
downloads

Publisher

verified publisherdartpub.tijingapp.com

Weekly Downloads

Serverpod helpers for Tencent Cloud COS.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

serverpod, tencent_cos_dart

More

Packages that depend on serverpod_cos