Skip to content

CUBETIQ/vfsclient-sdk-dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VFS Client SDK for Dart

Features:

  • Upload
  • Download
  • Delete
  • Cache
  • Support for Get file by File ID, File Key ({bucket_id}:{file_id}) and File URL (/v).
  • Support custom storeage for file upload store with local, s3, r2 and vfs options.

ToDo

  • Enhance the Get file and cache it by file URL. (For now, it's only work for URL with /v prefix)
  • Cache improvement.

Basic Usage

import 'package:vfsclient/src/types.dart';
import 'package:vfsclient/vfsclient.dart';

void main() async {
  final sdk = VFSClient.withOptions(
      url: "http://localhost:5002",
      apiKey: "",
      bucketId: "demo",
      cacheDir: ".cache");

  print("VFS Client SDK info: ${sdk.getVersionInfo()}");

  final isOk = await sdk.check();
  print("VFS Server is ok: $isOk");

  // Upload
  final uploadResult = await sdk.upload(UploadRequest.fromFile("cubetiq.jpeg"));
  print("Upload result: $uploadResult");

  // Cache file
  final cachedResult = await uploadResult?.cache();
  print("Cached result: $cachedResult");

  // Get file
  final fileId = uploadResult?.fileId ?? "";
  final getResult = await sdk.get(fileId);
  print("Get result: $getResult");

  // Delete file
  await sdk.delete(fileId);
  print("File deleted: $fileId");
}

Contributors

About

A VFS client SDK for Dart.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages