@@ -33,7 +33,7 @@ export class StorageFileApi {
3333 * @param file The File object to be stored in the bucket.
3434 * @param fileOptions HTTP headers. For example `cacheControl`
3535 */
36- async uploadFile (
36+ async upload (
3737 path : string ,
3838 file : File ,
3939 fileOptions ?: FileOptions
@@ -73,7 +73,7 @@ export class StorageFileApi {
7373 * @param file The file object to be stored in the bucket.
7474 * @param fileOptions HTTP headers. For example `cacheControl`
7575 */
76- async updateFile (
76+ async update (
7777 path : string ,
7878 file : File ,
7979 fileOptions ?: FileOptions
@@ -112,7 +112,7 @@ export class StorageFileApi {
112112 * @param fromPath The original file path, including the current file name. For example `folder/image.png`.
113113 * @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.
114114 */
115- async moveFile (
115+ async move (
116116 fromPath : string ,
117117 toPath : string
118118 ) : Promise < { data : { message : string } | null ; error : Error | null } > {
@@ -158,7 +158,7 @@ export class StorageFileApi {
158158 *
159159 * @param path The file path to be downloaded, including the path and file name. For example `folder/image.png`.
160160 */
161- async downloadFile ( path : string ) : Promise < { data : Blob | null ; error : Error | null } > {
161+ async download ( path : string ) : Promise < { data : Blob | null ; error : Error | null } > {
162162 try {
163163 const _path = this . _getFinalPath ( path )
164164 const res = await get ( `${ this . url } /object/${ _path } ` , {
@@ -173,28 +173,11 @@ export class StorageFileApi {
173173 }
174174
175175 /**
176- * Deletes a file.
177- *
178- * @param path The file path to be deleted, including the path and file name. For example `folder/image.png`.
179- */
180- async deleteFile (
181- path : string
182- ) : Promise < { data : { message : string } | null ; error : Error | null } > {
183- try {
184- const _path = this . _getFinalPath ( path )
185- const data = await remove ( `${ this . url } /object/${ _path } ` , { } , { headers : this . headers } )
186- return { data, error : null }
187- } catch ( error ) {
188- return { data : null , error }
189- }
190- }
191-
192- /**
193- * Deletes multiple files within the same bucket
176+ * Deletes files within the same bucket
194177 *
195178 * @param paths An array of files to be deletes, including the path and file name. For example [`folder/image.png`].
196179 */
197- async deleteFiles ( paths : string [ ] ) : Promise < { data : FileObject [ ] | null ; error : Error | null } > {
180+ async remove ( paths : string [ ] ) : Promise < { data : FileObject [ ] | null ; error : Error | null } > {
198181 try {
199182 const data = await remove (
200183 `${ this . url } /object/${ this . bucketId } ` ,
@@ -242,7 +225,7 @@ export class StorageFileApi {
242225 * @param path The folder path.
243226 * @param options Search options, including `limit`, `offset`, and `sortBy`.
244227 */
245- async listFiles (
228+ async list (
246229 path ?: string ,
247230 options ?: SearchOptions
248231 ) : Promise < { data : FileObject [ ] | null ; error : Error | null } > {
0 commit comments