How to split an array into multiple event triggers in Functional Reactive Programming?

  node.js, question

How to use the return value of an array to create more trigger events?

To give an example of handling files:

var glob = require('glob');
 var Rx = require('rx');
 var fs = require('fs');
 
 //Give an initial expression
 var source = Rx.Observable.just('*.md');
 
 //List files that match this expression
 var file = source.map(function(pattern) {
 return Rx.Observable.fromNodeCallback(glob)(pattern);
 });
 
 //Read a single file.  In fact, the parameter passed in after map is an array, but I expect a single value that iterates over the array.
 var reader = file.map(function(filename) {
 return Rx.Observable.fromNodeCallback(fs.readFile)(filename);
 });
 
 //Finally, iterate here to get the contents of each file.
 reader.subscribe(function(content) {
 console.log(content);
 });

The timing is roughly as follows:

listStream: ---A--------->
 splitStream: ---aaaaa----->
 readerStream: ----bbbbb---->

I have just come into contact with Reactive Programming, and I hope all kinds of scenes will try this idea.

If it is rx, it is better to directly from, but the glob function itself is callback at a time and will be packed in one place in the stream. It doesn’t make much sense. So. The only reactive place is reader.
In addition, source does not need to be packaged as monad, which is definitely something.