Added a file move method

This commit is contained in:
David Wakelin 2022-02-08 18:13:17 +00:00
parent bdd06aa0b7
commit 6b438e0b9a
3 changed files with 49 additions and 0 deletions

View file

@ -224,6 +224,19 @@ class File
return new self($this->space, $newFilename);
}
/**
* @param string $newFilename
*
* @return \SpacesAPI\File
*/
public function move(string $newFilename): File
{
$newFile = $this->copy($newFilename, $this->isPublic());
$this->delete();
return $newFile;
}
/**
* Get the public URL
* This URL will not work if the file is private