1.6.0 • Published 10 years ago

blkdat-parser v1.6.0

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

Blk*.dat file streaming parser

Parses the blk*.dat files that are created by Bitcoin Core. Allows for super fast replication of the blocks database

Supports mainnet and testnet3

npm i blkdat-parser

Example

var CombinedStream = require('combined-stream')
var fs = require('fs')
var glob = require('glob')
var parseBlock = require('bitcoin-block-streaming-parser')
var parseBlkDat = require('../')
var path = require('path')
var through = require('through2')

var dataDir = '/Users/stan/Library/Application Support/Bitcoin/testnet3/blocks'

glob('blk*.dat', { cwd: dataDir }, function (err, files) {
  var cs = CombinedStream.create()
  for (var j = 0; j < files.length; j++) {
    cs.append(fs.createReadStream(path.resolve(dataDir, files[j])))
  }
  cs
    .pipe(parseBlkDat('testnet3'))
    .pipe(parseBlock('testnet3'))
    .pipe(through.obj(function (chunk, enc, done) {
      console.log(chunk);
      done()
    }))
})

License MIT

1.6.0

10 years ago

1.5.1

10 years ago

1.4.1

10 years ago

1.4.0

10 years ago

1.3.0

11 years ago

1.2.0

11 years ago

1.1.1

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago