Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | var Parser = require("../lib/binary_parser.js").Parser; var fs = require("fs"); var chs = new Parser({ formatter: function(val) { val.cylinder |= val.cylinderHigh << 8; delete val.cylinderHigh; return val; } }) .uint8("head") .bit2("cylinderHigh") .bit6("sector") .uint8("cylinder"); var partitionTable = new Parser() .uint8("bootFlag") .nest("startCHS", { type: chs }) .uint8("type") .nest("endCHS", { type: chs }) .uint32le("startLBA") .uint32le("endLBA"); var mbrParser = new Parser() .skip(446) .array("partitionTables", { type: partitionTable, length: 4 }) .int16be("signature", { assert: 0x55aa }); fs.readFile("raspbian.img", function(err, data) { console.dir(mbrParser.parse(data), { depth: null, colors: true }); }); |