//tworzenie
buf256 = new Buffer(256);
bufOctets = new Buffer([0x6f, 0x63, 0x74, 0x65, 0x74, 0x73]);
bufUTF8 = new Buffer("Tekst UTF8 \u00b6 \u30c6 \u20ac", 'utf8');

//długość
console.log(Buffer.byteLength("Tekst UTF8 \u00b6", 'utf8'));
console.log("Tekst UTF8 \u00b6".length);
console.log(Buffer("Tekst UTF8 \u00b6").length);

//kopiowanie
var blank = new Buffer(26);
var dashes = new Buffer('-------------------------');
var alphabet = new Buffer('abcdefghijklmnopqrstuvwxyz');
console.log(alphabet.toString());
console.log(dashes.toString());
alphabet.copy(blank);
alphabet.copy(dashes, 10, 10, 15);
console.log(alphabet.toString());
console.log(blank.toString());
console.log(dashes.toString());

//podział
var numbers = new Buffer("123456789");
console.log(numbers.toString());
var slice = numbers.slice(3, 6);
console.log(slice.toString());
slice[0] = '#'.charCodeAt(0);
slice[slice.length-1] = '#'.charCodeAt(0);
console.log(numbers.toString());

//łączenie
var af = new Buffer("jaskółki afrykańskiej?");
var eu = new Buffer("jaskółki europejskiej?");
var question = new Buffer("Jaka jest prędkość ");
console.log(Buffer.concat([question, af]).toString());
console.log(Buffer.concat([question, eu]).toString());
