1
00:00:00,300 --> 00:00:00,810
Beautiful.

2
00:00:01,030 --> 00:00:05,550
Once we understand the basics now let's take a look at some additional info.

3
00:00:05,920 --> 00:00:12,170
Like I said, by default, the size of the buffer is going to be sixty four kilobytes.

4
00:00:12,180 --> 00:00:14,400
However, you can also control it.

5
00:00:14,700 --> 00:00:21,960
And the way we do that is by passing in the object when we're setting up create read stream.

6
00:00:22,170 --> 00:00:28,890
So first argument is going to be the path going in my case is going to be that big text file that I

7
00:00:28,890 --> 00:00:35,700
created using my file, using my model, and then I can pass in the options object.

8
00:00:35,880 --> 00:00:41,490
And in there, the property that you're looking for, the property that controls the size of the buffer,

9
00:00:42,060 --> 00:00:44,350
has the name of high watermark.

10
00:00:44,630 --> 00:00:51,820
So for example, if I go with ninety thousand here and of course you'll see that I'll have to cancel

11
00:00:51,830 --> 00:00:56,880
logs one for 90 kilobytes and the second one will be a reminder.

12
00:00:57,450 --> 00:01:03,060
Then keep in mind that our file size is one hundred and sixty nine kilobytes.

13
00:01:03,180 --> 00:01:03,950
That's number one.

14
00:01:04,260 --> 00:01:08,100
Number two, we can right away set up the encoding as well.

15
00:01:08,460 --> 00:01:12,600
So I go with comma and the proper name is encoding.

16
00:01:12,900 --> 00:01:19,980
And again, we'll set it up equal to UTF lecture and then you'll see in a console, of course, the

17
00:01:19,980 --> 00:01:20,630
hello world.

18
00:01:20,640 --> 00:01:20,990
Why?

19
00:01:21,000 --> 00:01:24,330
Well, because that is the content coming from the file.

20
00:01:24,540 --> 00:01:30,230
And lastly, I also would want to mention that we have the error event as well.

21
00:01:30,510 --> 00:01:38,070
So if I go stream and then on and we're checking for the error and as always, we can do something once

22
00:01:38,070 --> 00:01:44,220
that happens so that our callback function and in this case, I'll just access the error properly and

23
00:01:44,220 --> 00:01:45,870
I'll cancel the error.

24
00:01:46,230 --> 00:01:47,550
So I'll say here error.

25
00:01:47,790 --> 00:01:51,970
And the way we check that one out is by providing a wrong path.

26
00:01:51,990 --> 00:01:54,270
So in my case, I'm just going to add to that.

27
00:01:54,480 --> 00:02:02,160
And then once I say I've check it out in the console, I'll have the error where it tells me that no

28
00:02:02,160 --> 00:02:04,380
such file or directory.

