From 9087043019069e980351acabb05acbbaf04cec92 Mon Sep 17 00:00:00 2001 From: kajaharish Date: Thu, 28 Nov 2019 09:55:25 +0530 Subject: [PATCH] Update index.md In the copy a buffer section, there is a mistake: buf.copy(bufcopy, 0, 2,2) //it will print nothing since the source start and source end is specified as 2 in the original code correction: buf.copy(bufcopy, 0, 0, 2) // it will print the desired output that is 'He' --- src/documentation/0051-node-buffers/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/documentation/0051-node-buffers/index.md b/src/documentation/0051-node-buffers/index.md index e467529e2a..e946f26687 100644 --- a/src/documentation/0051-node-buffers/index.md +++ b/src/documentation/0051-node-buffers/index.md @@ -120,7 +120,7 @@ By default you copy the whole buffer. 3 more parameters let you define the start ```js const buf = Buffer.from('Hey!') let bufcopy = Buffer.alloc(2) //allocate 2 bytes -buf.copy(bufcopy, 0, 2, 2) +buf.copy(bufcopy, 0, 0, 2) bufcopy.toString() //'He' ```