title: Keep access to variables between pipe operators
body: <p>I have been trying to use Rxjs in a node app. <code>fileList$</code> is the return from <code>fs.readdirsync</code> (an array of strings).</p>
  
  <p>The first <code>map()</code> has a parameter called filename. </p>
  
  <p><code>flatMap() readFileAsObservable()</code> uses <code>bindNodeCallback(fs.readFile)</code> to read the file.</p>
  
  <p>My class <code>Testian</code> takes 2 args; The object created by <code>yaml-js</code> from reading the file and the <code>filename</code> from the first map. How can I access <code>filename</code> in the pipe where I have indicated?</p>
  
  <pre><code>fileList$
      .pipe(
          map((filename: string) =&gt; `${resolvedDirPath}/${filename}`),
          flatMap(
              (filePath: string) =&gt; readFileAsObservable(filePath, 'utf8') as Observable&lt;string&gt;
          ),
          map((fileData: string) =&gt; yaml.safeLoad(fileData) as ITestYaml),
          map((testYaml: ITestYaml) =&gt; new Testian(testYaml, [I want to use filename here])),
          flatMap((testYaml: Testian) =&gt; {
              const prom: Promise&lt;{}&gt; = activeTests.set(testYaml);
              outgoing.sendTest(testYaml);
              return from(prom);
          })
      )
  </code></pre>