@@ -33,7 +33,7 @@ export class StorageFileApi {
33
33
* @param file The File object to be stored in the bucket.
34
34
* @param fileOptions HTTP headers. For example `cacheControl`
35
35
*/
36
- async uploadFile (
36
+ async upload (
37
37
path : string ,
38
38
file : File ,
39
39
fileOptions ?: FileOptions
@@ -73,7 +73,7 @@ export class StorageFileApi {
73
73
* @param file The file object to be stored in the bucket.
74
74
* @param fileOptions HTTP headers. For example `cacheControl`
75
75
*/
76
- async updateFile (
76
+ async update (
77
77
path : string ,
78
78
file : File ,
79
79
fileOptions ?: FileOptions
@@ -112,7 +112,7 @@ export class StorageFileApi {
112
112
* @param fromPath The original file path, including the current file name. For example `folder/image.png`.
113
113
* @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.
114
114
*/
115
- async moveFile (
115
+ async move (
116
116
fromPath : string ,
117
117
toPath : string
118
118
) : Promise < { data : { message : string } | null ; error : Error | null } > {
@@ -158,7 +158,7 @@ export class StorageFileApi {
158
158
*
159
159
* @param path The file path to be downloaded, including the path and file name. For example `folder/image.png`.
160
160
*/
161
- async downloadFile ( path : string ) : Promise < { data : Blob | null ; error : Error | null } > {
161
+ async download ( path : string ) : Promise < { data : Blob | null ; error : Error | null } > {
162
162
try {
163
163
const _path = this . _getFinalPath ( path )
164
164
const res = await get ( `${ this . url } /object/${ _path } ` , {
@@ -173,28 +173,11 @@ export class StorageFileApi {
173
173
}
174
174
175
175
/**
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
194
177
*
195
178
* @param paths An array of files to be deletes, including the path and file name. For example [`folder/image.png`].
196
179
*/
197
- async deleteFiles ( paths : string [ ] ) : Promise < { data : FileObject [ ] | null ; error : Error | null } > {
180
+ async remove ( paths : string [ ] ) : Promise < { data : FileObject [ ] | null ; error : Error | null } > {
198
181
try {
199
182
const data = await remove (
200
183
`${ this . url } /object/${ this . bucketId } ` ,
@@ -242,7 +225,7 @@ export class StorageFileApi {
242
225
* @param path The folder path.
243
226
* @param options Search options, including `limit`, `offset`, and `sortBy`.
244
227
*/
245
- async listFiles (
228
+ async list (
246
229
path ?: string ,
247
230
options ?: SearchOptions
248
231
) : Promise < { data : FileObject [ ] | null ; error : Error | null } > {
0 commit comments