Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Create linked lists of Buffer objects and write binary parsers for these lists
JavaScript
branch: events

This branch is 57 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bufferlist
examples
tests
LICENSE
README
bufferlist.js

README

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;
Something went wrong with that request. Please try again.