Note that the ***********
//slice () method returns a new buffer, but the new BF2 and source object BF refer to the same .... That is, the change of BF2 will change the Bf
var bf=new Buffer (' Panwen ');
Console.log (BF); <buffer 6e 6e>
var bf2=bf.slice (1,4)//<buffer 6e 77>---intercept from subscript 1, intercept to 4, excluding 4
Console.log (BF2);
bf2[0]=0;
Console.log (BF2); <buffer 6e 77>
console.log (BF)//<buffer 6e 6e>//********
Note ***********
To achieve deep copy, use Buffer.copy (TEMBF);
var bf=new Buffer (' Panwen ');
Console.log (BF); <buffer 6e 6e>
var bf3=new Buffer (a);
var bf3=bf.copy (); That's not how it's written. , is the following writing//************** realize deep copy.
bf.copy (BF3);//This is copied to BF3. , the copy is also optional, bf.copy (bf3,1,2,4) is copied from the second to 3, 1 in real copy to the first bit of buffer.
Console.log (BF3);//<buffer 6e 6e 6f 00> after four-bit random, not initialized
bf3[0]=0;
Console.log (BF3);//<buffer 6e 00>
console.log (BF)//<buffer 6e 6f 6e>, No. Will change the original object