Skip to content

Commit

Permalink
refactor: Renamed methods
Browse files Browse the repository at this point in the history
  • Loading branch information
asafgardin committed Dec 5, 2024
1 parent af96613 commit bf6ad2a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/files/NodeFilesHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class NodeFilesHandler extends BaseFilesHandler {
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
private async handleStringFile(filePath: string, formData: any): Promise<void> {
private async createStreamFromFilePath(filePath: string, formData: any): Promise<void> {
if (!isNode) {
throw new Error('File system operations are not supported in browser environment');
}
Expand All @@ -42,8 +42,8 @@ export class NodeFilesHandler extends BaseFilesHandler {
const formData = new FormData();

if (typeof file === 'string') {
await this.handleStringFile(file, formData);
return this.createFormDataResponse(formData);
await this.createStreamFromFilePath(file, formData);
return this.createFormDataRequest(formData);
}

if (!file || typeof file !== 'object') {
Expand All @@ -55,7 +55,7 @@ export class NodeFilesHandler extends BaseFilesHandler {
filename: file.name,
contentType: file.type,
});
return this.createFormDataResponse(formData);
return this.createFormDataRequest(formData);
}

if ('stream' in file && typeof file.stream === 'function') {
Expand All @@ -64,7 +64,7 @@ export class NodeFilesHandler extends BaseFilesHandler {
filename: file.name,
contentType: file.type,
});
return this.createFormDataResponse(formData);
return this.createFormDataRequest(formData);
}

throw new Error(`Unsupported file type for Node.js file upload flow: ${file}`);
Expand All @@ -75,7 +75,7 @@ export class NodeFilesHandler extends BaseFilesHandler {
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
private createFormDataResponse(formData: any): FormDataRequest {
private createFormDataRequest(formData: any): FormDataRequest {
return {
formData,
headers: {
Expand Down

0 comments on commit bf6ad2a

Please sign in to comment.