-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
24 lines (18 loc) · 816 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Hackneyed Example:
var sys = require('sys');
var Buffer = require('buffer').Buffer;
var BufferList = require('bufferlist').BufferList;
var buf1 = new Buffer(5); buf1.write('abcde');
var buf2 = new Buffer(3); buf2.write('xyz');
var buf3 = new Buffer(5); buf3.write('11358');
var b = new BufferList;
b.push(buf1,buf2,buf3);
sys.puts(b.take(10)); // abcdexyz11
sys.puts(b.take(3)); // abc
sys.puts(b.take(100)); // abcdexyz11358
Buffer objects don't need to be buffer objects necessarily, but they should
implement methods that act like Buffer's toString, length, and copy.
To use a different kind of buffer object, set the constructor property:
var b = new BufferList({ construct : Bluffer });
var b = new BufferList;
b.construct = Buffur;