Hello i use mergemap from rxjs. I use array of object.
const list = [{name:'test',url:'https.....'}.....]
const source = from(list)
.pipe(mergeMap(getFile, null, 4))
.subscribe(saveDB);
In my getFile function I do downlaod file using axios to blob and in subscribe save. Now Lets say i wan to cancel all process for now i just return promise to reject, or if continue resolve. Is there better way ?
My goal is to downloading new files. getFile
return new Promise(async (resolve, reject) => {
//change on click for example
if (!downloadInProgress) {
reject("finish");
}
const dataToSave = {
...val,
blob: new Blob([response.data], { type: val.type }),
};
resolve(dataToSave);
})