I am working on a file encryption and upload class using Angular. Many of these operations are async and therefore the methods I wrote are returning RxJS Observables.
<
I think chaining your observables would do it, you can do it with flatMap (alias for mergeMap) maybe - https://stackoverflow.com/a/37777382/9176461 and RxJS Promise Composition (passing data)
As in my comment mentoined, something like the following should work (pseudo code):
public upload(file) {
const gen = this.indexGenerator(); // generator function
return Rx.Observable.just(file).pipe(
mergeMap(this.prepareUpload),
mergeMap(this.encryptData),
mergeMap(this.prepareEncDataUpload),
mergeMap(this.prepareEncDataUpload),
.... )
}