Skip to content
Walk a buffer, much like traditional C file I/O.
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
README.md
index.js
package.json

README.md

WalkBuf

Walk a buffer, as you read or write to it. Much like traditional file I/O in C, where a handle keeps track of the current position.

var WalkBuf = require('walkbuf');

var buf = new Buffer(16);
var walker = new WalkBuf(buf);

walker.writeUInt32BE(0xcafebabe);
walker.write('Hello!');
walker.skip(4);
walker.writeUInt16BE(9000);

walker.rewind();

walker.readUInt32BE();        // => 3405691582
walker.toString('utf-8', 6);  // => 'Hello!'
walker.skip(4);
walker.readUInt16BE();        // => 9000

MIT licensed.

Something went wrong with that request. Please try again.