< 26; i++) { buf[i] = i + 97;}
- Console.log (buf.tostring (' ASCII '));
- Console.log (buf.tostring (' ASCII ', 0,5));
- Console.log (buf.tostring (' UTF8 ', 0,5));
- Console.log (buf.tostring (Undefined, 0, 5));
Output
abcdefghijklmnopqrstuvwxyz abcde abcde abcde
ConstBuf= Buffer. from([0x1, 0x2, 0x3, 0x4, 0x5]);ConstJson= JSON.stringify(BUF);//output: {"type": "Buffer", "Data": [1,2,3,4,5]}Console.Log(JSON);ConstCopy= JSON.Parse(JSON,(Key,Value= { //Say I really don't understand the mechanism in this //This time if you print separatelyValue&& value.type === ' Buffer ' //Return is actually a false not that we understand a true //This time the output is correct returnValue&& value.type === ' Buffer ' ? Buffer. from(value.Data): Value; //This time the output is Lin returnValue&& value.type === ' Buffer ' ? "Lin"://LinValue; //This time the output is M returnValue&& value.type === ' Buffer ' ? "Lin":"M"; //M //This time the output is also m returnValue&& value.type === ' Buffer ' ? Buffer. from(value.Data) :"M"; //M});//output: <buffer 05>Console.Log(copy);
None.js Step Fifth buffer (buffer)