@@ -134,7 +134,11 @@ export class Application {
134134 * - This action is irreversible.
135135 */
136136 async delete ( ) : Promise < boolean > {
137- const { code } = await this . #apiManager. application ( 'delete' , this . id , true ) ;
137+ const { code } = await this . #apiManager. application (
138+ 'delete' ,
139+ this . id ,
140+ true
141+ ) ;
138142
139143 return code === 'APP_DELETED' ;
140144 }
@@ -149,28 +153,23 @@ export class Application {
149153 * ```
150154 * - Tip2: use zip file to commit more than one file
151155 *
152- * @param file - The absolute file path or a ReadStream
156+ * @param file - The absolute file path, a Buffer or a ReadStream
157+ * @param fileName - If a Buffer is provided you must provide the file name and extension too
153158 */
154159 async commit ( file : string | ReadStream ) : Promise < boolean > ;
155- async commit (
156- file : Buffer ,
157- fileName : string ,
158- fileExtension : `.${string } `
159- ) : Promise < boolean > ;
160+ async commit ( file : Buffer , fileName : string ) : Promise < boolean > ;
160161 async commit (
161162 file : string | ReadStream | Buffer ,
162- fileName ?: string ,
163- fileExtension ?: `.${string } `
163+ fileName ?: string
164164 ) : Promise < boolean > {
165165 validateCommitLike ( file , 'COMMIT_DATA' ) ;
166166
167167 const formData = new FormData ( ) ;
168168
169169 if ( file instanceof Buffer ) {
170170 validateString ( fileName , 'FILE_NAME' ) ;
171- validateString ( fileExtension , 'FILE_EXTENSION' ) ;
172171
173- formData . append ( 'file' , file , { filename : fileName + fileExtension } ) ;
172+ formData . append ( 'file' , file , { filename : fileName } ) ;
174173 } else {
175174 formData . append (
176175 'file' ,
@@ -180,8 +179,8 @@ export class Application {
180179
181180 const { code } = await this . #apiManager. application ( 'commit' , this . id , {
182181 method : 'POST' ,
183- data : formData ,
184- headers : { ... formData . getHeaders ( ) } ,
182+ body : formData . getBuffer ( ) ,
183+ headers : formData . getHeaders ( ) ,
185184 } ) ;
186185
187186 return code === 'SUCCESS' ;
0 commit comments