@@ -52,6 +52,8 @@ export class ApplicationFilesManager {
5252 */
5353 async create ( file : string | Buffer , fileName : string , path = "/" ) {
5454 assertPathLike ( file , "CREATE_FILE" ) ;
55+ assertString ( fileName , "CREATE_FILE_NAME" ) ;
56+ assertString ( path , "CREATE_FILE_PATH" ) ;
5557
5658 if ( typeof file === "string" ) {
5759 file = await readFile ( file ) ;
@@ -77,9 +79,30 @@ export class ApplicationFilesManager {
7779 * @param path - The absolute file path
7880 */
7981 async edit ( file : string | Buffer , path = "/" ) {
82+ assertPathLike ( file , "EDIT_FILE" ) ;
83+ assertString ( path , "EDIT_FILE_PATH" ) ;
84+
8085 return this . create ( file , "" , path ) ;
8186 }
8287
88+ /**
89+ * Moves or renames a file
90+ *
91+ * @param path - The current absolute file path
92+ * @param newPath - The new absolute file path
93+ */
94+ async move ( path : string , newPath : string ) {
95+ assertString ( path , "MOVE_FILE_PATH" ) ;
96+ assertString ( newPath , "MOVE_FILE_NEW_PATH" ) ;
97+
98+ const { status } = await this . application . client . api . request (
99+ Routes . apps . files . move ( this . application . id ) ,
100+ { method : "PATCH" , body : { path, to : newPath } } ,
101+ ) ;
102+
103+ return status === "success" ;
104+ }
105+
83106 /**
84107 * Deletes the specified file or directory
85108 *
0 commit comments