Skip to content

Commit

Permalink
fix: Node file checks
Browse files Browse the repository at this point in the history
  • Loading branch information
asafgardin committed Dec 4, 2024
1 parent 1b5b314 commit e3b31ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/files/NodeFilesHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export class NodeFilesHandler extends BaseFilesHandler {
async prepareFormDataRequest(file: FilePathOrFileObject): Promise<FormDataRequest> {
console.log('Preparing form data request for Node.js');
try {
const FormData = await import('form-data').then(m => m.default || m);
const FormData = await import('form-data').then((m) => m.default || m);
console.log('Successfully imported form-data module');

const formData = new FormData();
console.log('Created new FormData instance');

if (typeof file === 'string') {
const fs = await import('fs').then(m => m.default || m);
const fs = await import('fs').then((m) => m.default || m);
if (!fs.existsSync(file)) {
throw new Error(`File not found: ${file}`);
}
Expand Down

0 comments on commit e3b31ac

Please sign in to comment.