Get your own website
var buf1 = Buffer.from('b');
var buf2 = Buffer.from('c');
var buf3 = Buffer.from('a');
var arr = [buf1, buf2, buf3];

//The array before sorting:
console.log(arr);

//Sort the array:
console.log(arr.sort(Buffer.compare));

              

[ <Buffer 62>, <Buffer 63>, <Buffer 61> ]
[ <Buffer 61>, <Buffer 62>, <Buffer 63> ]