In this part, we are going to talk about above us and stream in and stream is to let us using the data
before fully to read.
And there are two ways to read the files.
And now you can see I already paste a large text file and there are a lot of parts here.
And one way is to wait until it has been read and the other is to pass the piece of data halfway through.
And a small chunk of data has picked up into a first and sent it on to the stream every time to for
it.
So now we back to the project and go to the app called Jazz, and we are going to delete this command
and we are going to create a stream to read that file.
So we are going to create a constant stream echo to create a stream.
And we are going to post a file to this so that we are going to read this file to file an enemy's passport
text.
So next year we type we stream stored on data and then tunc and we're stream on data and been listening
to the data everand on this stream.
So every time we get a chunk of data and we will fire this Corbat and this callback is going to do a
download, we indicate that this is a new chunk of data and then we also lock the chunk.
Now, if we won the program by typing knocked up and you can see this before us pop up in the console
in order to make this readable, we can go to here and at a two string method.
So if we run the program again and you can see these are the words instead of the puffer, we can also
has another method to make this readable.
And this is to add and compare the method in the second argument.
So we type and cocktailing and neuter it.
Now we can skip the two string method because we already have the uncoupling method of using UTF.
So if we run the program again, you can see these are also words instead of the.
Next, we are going to create a right stream to write a file.
So we at the constant of white screen is equal to stop create Lifestream and then we create a file name
of white stream text.
And then out here we can type white three dot right and back row slash.
And at last we are going to write stream.
Right.
That's wrong.
So now if we run the program by using looked at now you can see there is a white stream text here and
a neutron and also the task inside this file.
And at last we are going to take a look on the stream top pipe.
And this Mafa used to take readable stream and connect it to writable stream.
And this is a shorter way to do this same thing.
So we can combine this and we just need to use which stream, right?
Top pipe and white stream.
Now, if we delete the text file again.
And run the program and you can see the roistering file created again and all the tests are copied from
the last tests and to the right stream text file.