You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
556 B
20 lines
556 B
var Block = require('../lib/block');
|
|
var BufferReader = require('../lib/bufferreader');
|
|
var BufferWriter = require('../lib/bufferwriter');
|
|
|
|
//This example will parse the blocks in a block file.
|
|
//To use, pipe in a blk*****.dat file. e.g.:
|
|
//cat blk00000.dat | node blockreader.js
|
|
|
|
var bw = new BufferWriter();
|
|
|
|
process.stdin.on('data', function(buf) {
|
|
bw.write(buf);
|
|
});
|
|
|
|
process.stdin.on('end', function(buf) {
|
|
var blocksbuf = bw.concat();
|
|
var br = new BufferReader(blocksbuf);
|
|
while (!br.eof())
|
|
console.log(Block().fromBufferReader(br));
|
|
});
|
|
|