title: Angular 2 how to return from map function
body: <p>Angular 2 how to return from map if it has subscription inside</p>
  
  <pre><code>getImage(imageId: string): Observable&lt;ImageSource&gt; {
  
        return this.http.get(`${ImagesUrl}/${imageId}`, { 
          responseType: 'blob', observe: 'response' }).map((response) =&gt; {
          // here I am converting blob to base64
              let blob = response; // lets say response is blob
  
              let reader = new FileReader();
              reader.readAsDataURL(blob);
  
              reader.onloadend = (e) =&gt; {
                // how can I return from here?????
              };
        }
      }
  </code></pre>
  
  <p>is there a way to return from map only after onloadend event??</p>
  
  <p>Thanks in advance</p>