I have a function that uses spawn and calls ffmpeg to trim a file, which returns a Promise. I need to trim an audio file into multiple parts, so I iterate with a for loop which launches the trimming function, I only need the trimming process to complete (which generates the trimmed file) in the for loop (so I don't need to use await) but still need to make sure the trimming function did not return error.
for (let i = 0; i < myArray.length; i++) {
        trim().catch(console.error); //<--- Trim asynchronously
        linkedList.insertAtEnd(i); 
}
My problem is what is a good way to run the for loop trimming the audio asynchronously?
Edit: I don't want the trim() function to complete to iterate the next element in the array.
Edit: The difference between my question and this one is I don't want the for loop to wait for the trim() function in order to go on to the next element in the array.
 
    