from.move()

Moves an existing file, optionally renaming it at the same time.

const { data, error } = await supabase
.storage
.from('avatars')
.move('public/avatar1.png', 'private/avatar2.png')

Parameters

  • fromPathrequiredstring

    The original file path, including the current file name. For example folder/image.png.

  • toPathrequiredstring

    The new file path, including the new file name. For example folder/image-copy.png.

Notes

  • Policy permissions required:
    • buckets permissions: none
    • objects permissions: update and select

Examples

Move file

const { data, error } = await supabase
.storage
.from('avatars')
.move('public/avatar1.png', 'private/avatar2.png')