The following modifies a slice of a Buffer.
In doing so, it modifies the original Buffer too. If I were to perform a similar operation on an Array, then the original would remain unchanged.
So is this behavior the result of the specific implementation of the slice method on Node.js' Buffer?
const fs = require('fs');
fs.readFile(__filename, (err, buffer) => {
const tag = buffer.slice(-2, -1);
tag[0] = 'B';
console.log(buffer.toString());
});
// TAG: A