Skip to content

Commit

Permalink
chore: add move back into vPrevious docs
Browse files Browse the repository at this point in the history
  • Loading branch information
khatruong2009 committed May 20, 2024
1 parent a3db3c8 commit bd2f456
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/directory/directory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2315,6 +2315,9 @@ export const directory = {
{
path: 'src/pages/gen1/[platform]/prev/build-a-backend/storage/copy/index.mdx'
},
{
path: 'src/pages/gen1/[platform]/prev/build-a-backend/storage/move/index.mdx'
},
{
path: 'src/pages/gen1/[platform]/prev/build-a-backend/storage/remove/index.mdx'
},
Expand Down
26 changes: 26 additions & 0 deletions src/fragments/lib-v1/storage/flutter/move.mdx
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;
}
}
```
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 }} />

0 comments on commit bd2f456

Please sign in to comment.