Need to upload multiple pdf files using File API- Node
SOLVE
The below code works for a single file upload, but if I have an array of file paths
filePaths= ['abc.pdf', 'sample.pdf','xyz.pdf'] all files are in current directory. When I loop over the array, the code just uploads the last file 3 times to hubspot folder. I think fs.createReadStream() should be async. please advise
Creating new FormData for each file vs. reusing for the same instance
Use proper async/await handling versus mixing with .then()
Look into using Promise.all for doing concurrent uploads
Add error handling to both the individual files and the batch process
Best,
Jaycee
Join us on March 27th at 12 PM for the Digital Essentials Lab, an interactive session designed to redefine your digital strategy!
Engage with expert Jourdan Guyton to gain actionable insights, participate in live Q&A, and learn strategies to boost your business success. Don't miss this opportunity to connect and grow—reserve your spot today!
Did you know that the Community is available in other languages? Join regional conversations by changing your language settings !
Creating new FormData for each file vs. reusing for the same instance
Use proper async/await handling versus mixing with .then()
Look into using Promise.all for doing concurrent uploads
Add error handling to both the individual files and the batch process
Best,
Jaycee
Join us on March 27th at 12 PM for the Digital Essentials Lab, an interactive session designed to redefine your digital strategy!
Engage with expert Jourdan Guyton to gain actionable insights, participate in live Q&A, and learn strategies to boost your business success. Don't miss this opportunity to connect and grow—reserve your spot today!
Did you know that the Community is available in other languages? Join regional conversations by changing your language settings !