I am not able to assign a variable while a stream is being read in a component.
import { Component, OnInit } from '@angular/core';
var fs: any = require('fs');
 @Component({
 selector: 'stream-cmp',
 templateUrl: 'app/view/stream.html',
 styleUrls: ['./app/view/stream.css'],
 })
 export class StreamCmp {
 private _anotherVariable:any = null;
 private readstream:any = null;
 private filePath:any = '/dir/file';
 public fileUpload():void {
    this.readstream =  fs.createReadStream(this.filePath, {start: 140, end:  160});
    this.readstream.on('data', function (text) {
     console.log(text);
     this.filePath = text;
    });
 }
Basically, this.filePath is never assigned, I never see it in the view. But console.log always works.
Do I use change detection of some sort (maybe changedetectionref since it is supposed to be fast compared to NgZone)? Since it is a stream are we getting all of it at once? Is it an asynchronous stream? Is there a property on the fs module I should call to write the data to a variable? It seems the pipe function on the fs module is meant to write to files or other streams.
 
     
    