-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add move back into vPrevious docs
- Loading branch information
1 parent
a3db3c8
commit bd2f456
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
You can move an existing file to a different folder location in your S3 bucket. The user initiating the move operation must have read and write permission on both the source file and destination file. | ||
|
||
```dart | ||
import 'package:amplify_flutter/amplify_flutter.dart'; | ||
Future<void> movePrivateFile({ | ||
required String sourceKey, | ||
required String destinationKey, | ||
}) async { | ||
try { | ||
final result = await Amplify.Storage.move( | ||
source: StorageItemWithAccessLevel( | ||
storageItem: StorageItem(key: sourceKey), | ||
accessLevel: StorageAccessLevel.private, | ||
), | ||
destination: StorageItemWithAccessLevel( | ||
storageItem: StorageItem(key: destinationKey), | ||
accessLevel: StorageAccessLevel.private, | ||
), | ||
).result; | ||
safePrint('Moved file to: ${result.movedItem.key}'); | ||
} on StorageException catch (e) { | ||
safePrint('Something went wrong moving the file: ${e.message}'); | ||
rethrow; | ||
} | ||
} | ||
``` |
26 changes: 26 additions & 0 deletions
26
src/pages/gen1/[platform]/prev/build-a-backend/storage/move/index.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { getCustomStaticPath } from '@/utils/getCustomStaticPath'; | ||
|
||
export const meta = { | ||
title: 'Move files', | ||
description: "Learn more about how to move files using Amplify's storage category.", | ||
platforms: ['flutter'] | ||
}; | ||
|
||
export const getStaticPaths = async () => { | ||
return getCustomStaticPath(meta.platforms); | ||
}; | ||
|
||
export function getStaticProps(context) { | ||
return { | ||
props: { | ||
platform: context.params.platform, | ||
meta | ||
} | ||
}; | ||
} | ||
|
||
|
||
|
||
import flutter0 from '/src/fragments/lib-v1/storage/flutter/move.mdx'; | ||
|
||
<Fragments fragments={{ flutter: flutter0 }} /> |