Skip to content

Commit

Permalink
updated api explanations for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
ekjotmultani committed Nov 22, 2024
1 parent 6ac635e commit 01516d4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Future<void> copy() async {
```
## Specify a bucket or copy across buckets / regions

You can also perform an `copy` operation to a specific bucket by providing the `CopyBuckets` option.
You can also perform a `copy` operation to a specific bucket by providing the `CopyBuckets` option.
This option is an object that takes two `StorageBucket` parameters, which can be constructed by the specified name in the Amplify Backend, or the bucket name and region from the console.

```dart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,37 @@ final operation = Amplify.Storage.downloadFile(

### Example of `downloadData` with options

```dart
final operation = Amplify.Storage.downloadData(
path: const StoragePath.fromString('public/example.txt'),
options: StorageDownloadDataOptions(
pluginOptions: S3DownloadDataPluginOptions(
getProperties: true,
useAccelerateEndpoint: true,
bytesRange: S3DataBytesRange(start: 0, end: 100),
),
),
);
```

You can also perform a `downloadData` or `downloadFile` operation to a specific bucket by providing the `bucket` option. You can pass in a `StorageBucket` object representing the target bucket from the name defined in the Amplify Backend.

```dart
final operation = Amplify.Storage.downloadFile(
path: const StoragePath.fromString('public/example.txt'),
localFile: AWSFile.fromPath('/path/to/local/file.txt'),
options: const StorageDownloadFileOptions(
pluginOptions: S3DownloadFilePluginOptions(
getProperties: true,
useAccelerateEndpoint: true,
),
bucket: StorageBucket.fromOutputs('secondBucket'),
),
);
```

Alternatively, you can also pass in an object by specifying the bucket name and region from the console.

```dart
final operation = Amplify.Storage.downloadData(
path: const StoragePath.fromString('public/example.txt'),
Expand All @@ -1148,7 +1179,6 @@ final operation = Amplify.Storage.downloadData(
),
);
```

</InlineFilter>

<InlineFilter filters={["swift"]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ Future<void> listAllUnderPublicPath() async {
<InlineFilter filters={["flutter"]}>

### List files from a specified bucket
You can also perform a `list` operation to a specific bucket by providing the `bucket` option. You can pass in a object representing the target bucket in Amplify Backend.
You can also perform a `list` operation to a specific bucket by providing the `bucket` option. You can pass in a `StorageBucket` object representing the target bucket from the name defined in the Amplify Backend.

```dart
final result = await Amplify.Storage.list(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ let removedObject = try await Amplify.Storage.remove(

<InlineFilter filters={["flutter"]}>

You can also perform a remove operation from a specific bucket by providing the target bucket's assigned name from Amplify Backend in `bucket` option.
You can also perform a `remove` operation to a specific bucket by providing the `bucket` option. You can pass in a `StorageBucket` object representing the target bucket from the name defined in the Amplify Backend.

```dart
final result = await Amplify.Storage.remove(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ Future<void> upload() async {

### Upload to a specified bucket

You can also perform an `upload` operation to a specific bucket by providing the `bucket` option. You can pass in an object representing the target bucket in Amplify Backend.
You can also perform an `upload` operation to a specific bucket by providing the `bucket` option. You can pass in a `StorageBucket` object representing the target bucket from the name defined in the Amplify Backend.

```dart
final data = 'multi bucket upload data byte'.codeUnits;
Expand Down

0 comments on commit 01516d4

Please sign in to comment.