搜尋套件、儲存庫與 APP 分類

套件詳情v0.6.0

flutter_aws_s3_client

一個簡單的、非官方的 Dart AWS S3 客戶端。支援下載物件和列出儲存桶中的物件。

AndroidiOSmacOSWindowsLinux
近 30 天下載
123
喜歡數
35
Pub 分數
100

安裝套件

flutter pub add flutter_aws_s3_client

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個輕量級的、非官方的 AWS S3 客戶端,適用於 Flutter 和 Dart,可實現與 Amazon S3 的簡單互動。它支援下載物件和列出儲存桶內的內容,適用於需要從 S3 進行基本檔案檢索和瀏覽的應用程式。此套件專為跨平台使用設計,可在 Android、iOS、macOS、Windows 和 Linux 上運行。該套件並非由 AWS 官方維護,但提供無需複雜依賴的簡便存取方式。

適用情境

  • 從 S3 儲存桶下載檔案
  • 列出 S3 儲存桶中的物件
  • 將 S3 儲存整合到 Flutter 應用中
  • 雲環境中的簡單檔案管理
  • 跨平台雲端檔案存取

主要特色

  • 支援 S3 物件下載
  • 列出儲存桶中的物件
  • 輕量且依賴極少
  • 跨平台相容性
  • 無需官方 AWS SDK

適合對象

  • 使用 S3 集成開發 Flutter 應用的開發者
  • 需要基本 S3 操作的項目
  • 需要從 AWS S3 檢索檔案的應用程式
  • 原型或小規模雲端儲存需求
  • 具有簡單S3需求的非企業應用程式

使用建議

  • 非官方 AWS SDK
  • 限制為下載和列表操作
  • 無上傳或進階S3功能
  • 可能需要手動處理驗證
  • 最適合非關鍵或實驗性使用案例

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Pub Package

DEPRECATED

Since there is now an official package for accessing AWS services, I decided to not longer support this package. please migrate to https://github.com/aws-amplify/amplify-flutter / https://pub.dev/packages/amplify_storage_s3/example

flutter_aws_s3_client

Supports downloading objects and listing objects in a bucket.

The heavy lifting was done by Amazon Cognito Identity SDK for Dart, this project contains just convenience methods for common use cases.

if you need more requests, you can use this instead to build what you need. If you implement more methods, feel free to open a pull request.

Usage

Build the client
  const region = "eu-central-1";
  const bucketId = "yourBucketId";
  final AwsS3Client s3client = AwsS3Client(
      region: region,
      host: "s3.$region.amazonaws.com",
      bucketId: bucketId,
      accessKey: "<your access key>",
      secretKey: "<your secret key>");

Get an object
final response = await s3client.getObject("your/object/key"); 
List objects of the bucket
ListBucketResult listBucketResult =
  await s3client.listObjects(prefix: "dir1/dir2/", delimiter: "/");
print(listBucketResult.toString());

If you want to use a custom http client, use the method buildSignedGetParams. This method returns an object containing the URL and the Authorization headers, which can be used to build the request with your preferred http client.

Download a large object to a file without keeping everything in-memory (streaming)

Use the buildSignedGetParams method.

Example code (with ETag support):


Future download(String key, File file, [String etag = null]) async {

  final signedParams = awsS3Client.buildSignedGetParams(key: key);

  final request = await HttpClient().getUrl(signedParams.uri);

  for (final header in (signedParams.headers ?? const {}).entries) {
    request.headers.add(header.key, header.value);
  }
  if(eTag != null){
    request.headers.add(HttpHeaders.ifNoneMatchHeader, eTag);
  }
  final response = response = await request.close();
  if(response.statusCode != HttpStatus.ok){
     //handle error  
  }else{
     return response.pipe(file.openWrite());
  }
}

所屬分類

依賴

依賴清單 5 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。