craft_oss 0.1.0 copy "craft_oss: ^0.1.0" to clipboard
craft_oss: ^0.1.0 copied to clipboard

Dart SDK and command-line client for CraftOSS object storage, with HMAC authentication and resumable multipart uploads.

example/craft_oss_example.dart

import 'dart:io';

import 'package:craft_oss/craft_oss.dart';

Future<void> main() async {
  final CraftOssClient client = CraftOssClient(
    endpoint: Uri.parse(
      Platform.environment['CRAFT_OSS_ENDPOINT'] ?? 'http://127.0.0.1:9606',
    ),
    credentials: CraftOssCredentials(
      appId: _requiredEnvironment('CRAFT_OSS_APP_ID'),
      accessKeyId: _requiredEnvironment('CRAFT_OSS_ACCESS_KEY_ID'),
      accessKeySecret: _requiredEnvironment('CRAFT_OSS_ACCESS_KEY_SECRET'),
    ),
  );
  try {
    final bool healthy = await client.health();
    stdout.writeln('CraftOSS healthy: $healthy');
  } finally {
    client.close();
  }
}

String _requiredEnvironment(String name) {
  final String? value = Platform.environment[name];
  if (value == null || value.isEmpty) {
    throw StateError('Missing environment variable: $name');
  }
  return value;
}
0
likes
150
points
343
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dart SDK and command-line client for CraftOSS object storage, with HMAC authentication and resumable multipart uploads.

Repository (GitHub)
View/report issues

Topics

#object-storage #oss #hmac #multipart-upload #cli

License

GPL-3.0 (license)

Dependencies

args, crypto, http, uuid

More

Packages that depend on craft_oss