diff --git a/README.md b/README.md index 0d2e8eeef5258529f898f6240add19520447c668..cc0c02b08b19f8ed0b4cce50b0ba71274eb03782 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ This is the _unofficial_ MinIO Dart Client SDK that provides simple APIs to acce | Bucket operations | Object operations | Presigned operations | Bucket Policy & Notification operations | |-------------------------|-------------------------|-----------------------|-------------------------------------------| | [makeBucket] | [getObject] | [presignedUrl] | getBucketNotification | -| [listBuckets] | [getPartialObject] | presignedGetObject | setBucketNotification | -| [bucketExists] | [fGetObject] | presignedPutObject | removeAllBucketNotification | +| [listBuckets] | [getPartialObject] | [presignedGetObject] | setBucketNotification | +| [bucketExists] | [fGetObject] | [presignedPutObject] | removeAllBucketNotification | | [removeBucket] | [putObject] | presignedPostPolicy | getBucketPolicy | | [listObjects] | [fPutObject] | | setBucketPolicy | | [listObjectsV2] | [copyObject] | | listenBucketNotification | @@ -93,4 +93,6 @@ MIT [fPutObject]: https://pub.dev/documentation/minio/latest/io/MinioX/fPutObject.html [presignedUrl]: https://pub.dev/documentation/minio/latest/minio/Minio/presignedUrl.html +[presignedGetObject]: https://pub.dev/documentation/minio/latest/minio/Minio/presignedGetObject.html +[presignedPutObject]: https://pub.dev/documentation/minio/latest/minio/Minio/presignedPutObject.html diff --git a/lib/src/minio.dart b/lib/src/minio.dart index 83433b987d0755d8198e218e8804fd926c80bc44..b2baeaa4ab17e619d79418e97108f11120b9699f 100644 --- a/lib/src/minio.dart +++ b/lib/src/minio.dart @@ -641,6 +641,22 @@ class Minio { ); } + /// Generate a presigned URL for PUT. + /// Using this URL, the browser can upload to S3 only with the specified object name. + /// + /// - [bucketName]: name of the bucket + /// - [objectName]: name of the object + /// - [expires]: expiry in seconds (optional, default 7 days) + Future<String> presignedPutObject( + String bucket, + String object, { + int expires, + }) { + MinioInvalidBucketNameError.check(bucket); + MinioInvalidObjectNameError.check(object); + return presignedUrl('PUT', bucket, object, expires: expires); + } + /// Generate a generic presigned URL which can be /// used for HTTP methods GET, PUT, HEAD and DELETE ///